FINERACT-1694: Making Avro mapping to fail at compile time for unmapped properties

This commit is contained in:
Arnold Galovics
2022-09-06 13:05:22 +02:00
committed by Arnold Gálovics
parent 3f1743a3d4
commit 4f312f33f6
157 changed files with 931 additions and 2919 deletions
@@ -13,7 +13,7 @@
}, },
{ {
"default": null, "default": null,
"name": "code", "name": "role",
"type": [ "type": [
"null", "null",
"org.apache.fineract.avro.generic.v1.CodeValueDataV1" "org.apache.fineract.avro.generic.v1.CodeValueDataV1"
@@ -416,7 +416,7 @@
"name": "timeline", "name": "timeline",
"type": [ "type": [
"null", "null",
"org.apache.fineract.avro.generic.v1.EnumOptionDataV1" "org.apache.fineract.avro.loan.v1.LoanApplicationTimelineDataV1"
] ]
}, },
{ {
@@ -88,7 +88,7 @@
"name": "timeline", "name": "timeline",
"type": [ "type": [
"null", "null",
"org.apache.fineract.avro.loan.v1.LoanApplicationTimelineV1" "org.apache.fineract.avro.loan.v1.LoanApplicationTimelineDataV1"
] ]
}, },
{ {
@@ -1,5 +1,5 @@
{ {
"name": "LoanApplicationTimelineV1", "name": "LoanApplicationTimelineDataV1",
"namespace": "org.apache.fineract.avro.loan.v1", "namespace": "org.apache.fineract.avro.loan.v1",
"type": "record", "type": "record",
"fields": [ "fields": [
@@ -325,7 +325,7 @@
}, },
{ {
"default": null, "default": null,
"name": "allowPartialPeriodInterestCalcualtion", "name": "allowPartialPeriodInterestCalculation",
"type": [ "type": [
"null", "null",
"boolean" "boolean"
@@ -128,7 +128,10 @@
"name": "periods", "name": "periods",
"type": [ "type": [
"null", "null",
"org.apache.fineract.avro.loan.v1.LoanSchedulePeriodDataV1" {
"type": "array",
"items": "org.apache.fineract.avro.loan.v1.LoanSchedulePeriodDataV1"
}
] ]
}, },
{ {
@@ -136,7 +139,10 @@
"name": "futurePeriods", "name": "futurePeriods",
"type": [ "type": [
"null", "null",
"org.apache.fineract.avro.loan.v1.LoanSchedulePeriodDataV1" {
"type": "array",
"items": "org.apache.fineract.avro.loan.v1.LoanSchedulePeriodDataV1"
}
] ]
} }
] ]
@@ -21,7 +21,7 @@
}, },
{ {
"default": null, "default": null,
"name": "description", "name": "value",
"type": [ "type": [
"null", "null",
"string" "string"
@@ -37,7 +37,7 @@
}, },
{ {
"default": null, "default": null,
"name": "rejectedOnDate", "name": "rejectedDate",
"type": [ "type": [
"null", "null",
"string" "string"
@@ -69,7 +69,7 @@
}, },
{ {
"default": null, "default": null,
"name": "approvedOnDate", "name": "approvedDate",
"type": [ "type": [
"null", "null",
"string" "string"
@@ -101,7 +101,7 @@
}, },
{ {
"default": null, "default": null,
"name": "activatedOnDate", "name": "activatedDate",
"type": [ "type": [
"null", "null",
"string" "string"
@@ -133,7 +133,7 @@
}, },
{ {
"default": null, "default": null,
"name": "closedOnDate", "name": "closedDate",
"type": [ "type": [
"null", "null",
"string" "string"
+18 -2
View File
@@ -45,7 +45,7 @@ task buildJavaSdk(type: org.openapitools.generator.gradle.plugin.tasks.GenerateT
validateSpec = false validateSpec = false
skipValidateSpec = true skipValidateSpec = true
inputSpec = "file:///$swaggerFile" inputSpec = "file:///$swaggerFile"
outputDir = "$buildDir/generated/java".toString() outputDir = "$buildDir/generated/temp-java".toString()
templateDir = "$projectDir/src/main/resources/templates/java" templateDir = "$projectDir/src/main/resources/templates/java"
groupId = 'org.apache.fineract' groupId = 'org.apache.fineract'
apiPackage = 'org.apache.fineract.client.services' apiPackage = 'org.apache.fineract.client.services'
@@ -110,8 +110,24 @@ task buildAsciidoc(type: org.openapitools.generator.gradle.plugin.tasks.Generate
dependsOn(':fineract-provider:resolve') dependsOn(':fineract-provider:resolve')
} }
task cleanupJodaImports() {
// This is a temporary step to get rid of joda imports in the generated code
// At this point it's unknown why it's even generated, probably it's a bug in the generator
doLast {
copy {
from "$buildDir/generated/temp-java".toString()
into "$buildDir/generated/java".toString()
filter { line ->
line.replaceAll("import org\\.joda\\.time\\.\\*;", "")
}
}
}
dependsOn("buildJavaSdk")
}
// TODO: @vidakovic we could provide even more client libs in different languages (Go, Ruby, Swift etc.) // TODO: @vidakovic we could provide even more client libs in different languages (Go, Ruby, Swift etc.)
compileJava.dependsOn(buildJavaSdk, buildTypescriptAngularSdk, buildAsciidoc, licenseFormatMain, spotlessMiscApply) compileJava.dependsOn(buildJavaSdk, buildTypescriptAngularSdk, buildAsciidoc, cleanupJodaImports, licenseFormatMain, spotlessMiscApply)
java { java {
// keep this at Java 8, not 17; see https://issues.apache.org/jira/browse/FINERACT-1214 // keep this at Java 8, not 17; see https://issues.apache.org/jira/browse/FINERACT-1214
@@ -212,7 +212,7 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
if (PortfolioAccountType.fromInt(entityTypeId).isLoanAccount()) { if (PortfolioAccountType.fromInt(entityTypeId).isLoanAccount()) {
final LoanTransactionEnumData loanTransactionType = LoanEnumerations final LoanTransactionEnumData loanTransactionType = LoanEnumerations
.transactionType(JdbcSupport.getInteger(rs, "loanTransactionType")); .transactionType(JdbcSupport.getInteger(rs, "loanTransactionType"));
transactionTypeEnumData = new TransactionTypeEnumData(loanTransactionType.id(), loanTransactionType.getCode(), transactionTypeEnumData = new TransactionTypeEnumData(loanTransactionType.getId(), loanTransactionType.getCode(),
loanTransactionType.getValue()); loanTransactionType.getValue());
} else if (PortfolioAccountType.fromInt(entityTypeId).isSavingsAccount()) { } else if (PortfolioAccountType.fromInt(entityTypeId).isSavingsAccount()) {
final SavingsAccountTransactionEnumData savingsTransactionType = SavingsEnumerations final SavingsAccountTransactionEnumData savingsTransactionType = SavingsEnumerations
@@ -444,8 +444,9 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
final LocalDate transactionDate = DateUtils.getBusinessLocalDate(); final LocalDate transactionDate = DateUtils.getBusinessLocalDate();
return OfficeOpeningBalancesData.createNew(officeId, officeData.name(), transactionDate, contraAccount, assetAccountOpeningBalances, return OfficeOpeningBalancesData.createNew(officeId, officeData.getName(), transactionDate, contraAccount,
liabilityAccountOpeningBalances, incomeAccountOpeningBalances, equityAccountOpeningBalances, expenseAccountOpeningBalances); assetAccountOpeningBalances, liabilityAccountOpeningBalances, incomeAccountOpeningBalances, equityAccountOpeningBalances,
expenseAccountOpeningBalances);
} }
private List<JournalEntryData> populateOpeningBalances(final List<JournalEntryData> existingOpeningBalanceTransactions, private List<JournalEntryData> populateOpeningBalances(final List<JournalEntryData> existingOpeningBalanceTransactions,
@@ -276,7 +276,7 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
if (StringUtils.isNotBlank(officeIdStr)) { if (StringUtils.isNotBlank(officeIdStr)) {
officeId = Long.valueOf(officeIdStr); officeId = Long.valueOf(officeIdStr);
final OfficeData office = this.officeReadPlatformService.retrieveOffice(officeId); final OfficeData office = this.officeReadPlatformService.retrieveOffice(officeId);
commandAsJsonMap.put("officeName", office.name()); commandAsJsonMap.put("officeName", office.getName());
} else { } else {
commandAsJsonMap.put("officeName", ""); commandAsJsonMap.put("officeName", "");
} }
@@ -290,7 +290,7 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
if (StringUtils.isNotBlank(clientIdStr)) { if (StringUtils.isNotBlank(clientIdStr)) {
clientId = Long.valueOf(clientIdStr); clientId = Long.valueOf(clientIdStr);
final ClientData client = this.clientReadPlatformService.retrieveOne(clientId); final ClientData client = this.clientReadPlatformService.retrieveOne(clientId);
commandAsJsonMap.put("clientName", client.displayName()); commandAsJsonMap.put("clientName", client.getDisplayName());
} else { } else {
commandAsJsonMap.put("clientName", ""); commandAsJsonMap.put("clientName", "");
} }
@@ -91,7 +91,7 @@ public class SynchronousCommandProcessingService implements CommandProcessingSer
} else { } else {
commandSourceResult = CommandSource.fullEntryFrom(wrapper, command, maker); commandSourceResult = CommandSource.fullEntryFrom(wrapper, command, maker);
} }
commandSourceResult.updateResourceId(result.resourceId()); commandSourceResult.updateResourceId(result.getResourceId());
commandSourceResult.updateForAudit(result.getOfficeId(), result.getGroupId(), result.getClientId(), result.getLoanId(), commandSourceResult.updateForAudit(result.getOfficeId(), result.getGroupId(), result.getClientId(), result.getLoanId(),
result.getSavingsId(), result.getProductId(), result.getTransactionId()); result.getSavingsId(), result.getProductId(), result.getTransactionId());
@@ -33,7 +33,7 @@ public class ClientIdSerializer implements JsonSerializer<Collection<ClientData>
public JsonElement serialize(Collection<ClientData> src, Type typeOfSrc, JsonSerializationContext context) { public JsonElement serialize(Collection<ClientData> src, Type typeOfSrc, JsonSerializationContext context) {
JsonArray clientIdJsonArray = new JsonArray(); JsonArray clientIdJsonArray = new JsonArray();
for (ClientData client : src) { for (ClientData client : src) {
JsonElement clientIdElment = new JsonPrimitive(client.id().toString()); JsonElement clientIdElment = new JsonPrimitive(client.getId().toString());
clientIdJsonArray.add(clientIdElment); clientIdJsonArray.add(clientIdElment);
} }
return clientIdJsonArray; return clientIdJsonArray;
@@ -29,6 +29,6 @@ public class CurrencyDateCodeSerializer implements JsonSerializer<CurrencyData>
@Override @Override
public JsonElement serialize(CurrencyData src, Type typeOfSrc, JsonSerializationContext context) { public JsonElement serialize(CurrencyData src, Type typeOfSrc, JsonSerializationContext context) {
return new JsonPrimitive(src.code()); return new JsonPrimitive(src.getCode());
} }
} }
@@ -100,7 +100,7 @@ public abstract class AbstractWorkbookPopulator implements WorkbookPopulator {
int rowIndex = 0; int rowIndex = 0;
for (OfficeData office : offices) { for (OfficeData office : offices) {
Row row = sheet.createRow(++rowIndex); Row row = sheet.createRow(++rowIndex);
writeString(officeNameCol, row, office.name().trim().replaceAll("[ )(]", "_")); writeString(officeNameCol, row, office.getName().trim().replaceAll("[ )(]", "_"));
writeDate(activationDateCol, row, "" + office.getOpeningDate().getDayOfMonth() + "/" writeDate(activationDateCol, row, "" + office.getOpeningDate().getDayOfMonth() + "/"
+ office.getOpeningDate().getMonthValue() + "/" + office.getOpeningDate().getYear(), dateCellStyle, dateFormat); + office.getOpeningDate().getMonthValue() + "/" + office.getOpeningDate().getYear(), dateCellStyle, dateFormat);
@@ -123,7 +123,7 @@ public abstract class AbstractWorkbookPopulator implements WorkbookPopulator {
if (row == null) { if (row == null) {
row = sheet.createRow(rowIndex); row = sheet.createRow(rowIndex);
} }
writeString(nameCol, row, client.displayName().replaceAll("[ )(] ", "_") + "(" + client.id() + ")"); writeString(nameCol, row, client.getDisplayName().replaceAll("[ )(] ", "_") + "(" + client.getId() + ")");
if (client.getActivationDate() != null) { if (client.getActivationDate() != null) {
writeDate(activationDateCol, row, outputFormat.format(client.getActivationDate()), dateCellStyle, dateFormat); writeDate(activationDateCol, row, outputFormat.format(client.getActivationDate()), dateCellStyle, dateFormat);
@@ -72,11 +72,11 @@ public class CenterSheetPopulator extends AbstractWorkbookPopulator {
Row row = centerSheet.createRow(rowIndex); Row row = centerSheet.createRow(rowIndex);
for (OfficeData office : offices) { for (OfficeData office : offices) {
startIndex = rowIndex + 1; startIndex = rowIndex + 1;
writeString(OFFICE_NAME_COL, row, office.name()); writeString(OFFICE_NAME_COL, row, office.getName());
ArrayList<String> centersList = new ArrayList<String>(); ArrayList<String> centersList = new ArrayList<String>();
if (officeToCenters.containsKey(office.name().trim().replaceAll("[ )(]", "_"))) { if (officeToCenters.containsKey(office.getName().trim().replaceAll("[ )(]", "_"))) {
centersList = officeToCenters.get(office.name().trim().replaceAll("[ )(]", "_")); centersList = officeToCenters.get(office.getName().trim().replaceAll("[ )(]", "_"));
if (!centersList.isEmpty()) { if (!centersList.isEmpty()) {
for (String centerName : centersList) { for (String centerName : centersList) {
writeString(CENTER_NAME_COL, row, centerName); writeString(CENTER_NAME_COL, row, centerName);
@@ -62,7 +62,7 @@ public class ClientSheetPopulator extends AbstractWorkbookPopulator {
private void setClientNameToClientIdMap() { private void setClientNameToClientIdMap() {
clientNameToClientId = new HashMap<>(); clientNameToClientId = new HashMap<>();
for (ClientData clientData : allClients) { for (ClientData clientData : allClients) {
clientNameToClientId.put(clientData.displayName().trim() + "(" + clientData.id() + ")", clientData.id()); clientNameToClientId.put(clientData.getDisplayName().trim() + "(" + clientData.getId() + ")", clientData.getId());
} }
} }
@@ -82,14 +82,14 @@ public class ClientSheetPopulator extends AbstractWorkbookPopulator {
officeToClients = new HashMap<>(); officeToClients = new HashMap<>();
for (ClientData person : allClients) { for (ClientData person : allClients) {
addToOfficeClientMap(person.getOfficeName().trim().replaceAll("[ )(]", "_"), addToOfficeClientMap(person.getOfficeName().trim().replaceAll("[ )(]", "_"),
person.displayName().trim() + "(" + person.id() + ")"); person.getDisplayName().trim() + "(" + person.getId() + ")");
} }
} }
private void setClientNameToSavingsAccountsIdsMap() { private void setClientNameToSavingsAccountsIdsMap() {
clientNameToSavingsAccountIds = new HashMap<>(); clientNameToSavingsAccountIds = new HashMap<>();
for (ClientData client : allClients) { for (ClientData client : allClients) {
clientNameToSavingsAccountIds.put(client.displayName().trim() + "(" + client.id() + ")", client.getSavingsAccountId()); clientNameToSavingsAccountIds.put(client.getDisplayName().trim() + "(" + client.getId() + ")", client.getSavingsAccountId());
} }
} }
@@ -112,10 +112,10 @@ public class ClientSheetPopulator extends AbstractWorkbookPopulator {
Row row = clientSheet.createRow(rowIndex); Row row = clientSheet.createRow(rowIndex);
for (OfficeData office : officesDataList) { for (OfficeData office : officesDataList) {
startIndex = rowIndex + 1; startIndex = rowIndex + 1;
writeString(OFFICE_NAME_COL, row, office.name()); writeString(OFFICE_NAME_COL, row, office.getName());
ArrayList<String> clientList = new ArrayList<String>(); ArrayList<String> clientList = new ArrayList<String>();
if (officeToClients.containsKey(office.name().trim().replaceAll("[ )(]", "_"))) { if (officeToClients.containsKey(office.getName().trim().replaceAll("[ )(]", "_"))) {
clientList = officeToClients.get(office.name().trim().replaceAll("[ )(]", "_")); clientList = officeToClients.get(office.getName().trim().replaceAll("[ )(]", "_"));
} }
if (!clientList.isEmpty()) { if (!clientList.isEmpty()) {
for (String clientName : clientList) { for (String clientName : clientList) {
@@ -77,7 +77,7 @@ public class ExtrasSheetPopulator extends AbstractWorkbookPopulator {
} }
writeString(CURRENCY_NAME_COL, row, currencies.getName().trim().replaceAll("[ )(]", "_")); writeString(CURRENCY_NAME_COL, row, currencies.getName().trim().replaceAll("[ )(]", "_"));
writeString(CURRENCY_CODE_COL, row, currencies.code()); writeString(CURRENCY_CODE_COL, row, currencies.getCode());
} }
extrasSheet.protectSheet(""); extrasSheet.protectSheet("");
@@ -117,7 +117,7 @@ public class FixedDepositProductSheetPopulator extends AbstractWorkbookPopulator
writeString(LOCKIN_PERIOD_FREQUENCY_COL, row, product.getLockinPeriodFrequencyType().getValue()); writeString(LOCKIN_PERIOD_FREQUENCY_COL, row, product.getLockinPeriodFrequencyType().getValue());
} }
CurrencyData currency = product.getCurrency(); CurrencyData currency = product.getCurrency();
writeString(CURRENCY_COL, row, currency.code()); writeString(CURRENCY_COL, row, currency.getCode());
} }
productSheet.protectSheet(""); productSheet.protectSheet("");
} }
@@ -93,11 +93,11 @@ public class GroupSheetPopulator extends AbstractWorkbookPopulator {
Row row = groupSheet.createRow(rowIndex); Row row = groupSheet.createRow(rowIndex);
for (OfficeData office : offices) { for (OfficeData office : offices) {
startIndex = rowIndex + 1; startIndex = rowIndex + 1;
writeString(OFFICE_NAME_COL, row, office.name()); writeString(OFFICE_NAME_COL, row, office.getName());
ArrayList<String> groupsList = new ArrayList<>(); ArrayList<String> groupsList = new ArrayList<>();
if (officeToGroups.containsKey(office.name().trim().replaceAll("[ )(]", "_"))) { if (officeToGroups.containsKey(office.getName().trim().replaceAll("[ )(]", "_"))) {
groupsList = officeToGroups.get(office.name().trim().replaceAll("[ )(]", "_")); groupsList = officeToGroups.get(office.getName().trim().replaceAll("[ )(]", "_"));
} }
if (!groupsList.isEmpty()) { if (!groupsList.isEmpty()) {
@@ -51,7 +51,7 @@ public class OfficeSheetPopulator extends AbstractWorkbookPopulator {
for (OfficeData office : offices) { for (OfficeData office : offices) {
Row row = officeSheet.createRow(rowIndex); Row row = officeSheet.createRow(rowIndex);
writeLong(ID_COL, row, office.getId()); writeLong(ID_COL, row, office.getId());
writeString(OFFICE_NAME_COL, row, office.name().trim().replaceAll("[ )(]", "_")); writeString(OFFICE_NAME_COL, row, office.getName().trim().replaceAll("[ )(]", "_"));
rowIndex++; rowIndex++;
} }
} }
@@ -72,7 +72,7 @@ public class OfficeSheetPopulator extends AbstractWorkbookPopulator {
public List<String> getOfficeNames() { public List<String> getOfficeNames() {
List<String> officeNames = new ArrayList<>(); List<String> officeNames = new ArrayList<>();
for (OfficeData office : offices) { for (OfficeData office : offices) {
officeNames.add(office.name()); officeNames.add(office.getName());
} }
return officeNames; return officeNames;
} }
@@ -77,9 +77,9 @@ public class PersonnelSheetPopulator extends AbstractWorkbookPopulator {
Row row = staffSheet.createRow(rowIndex); Row row = staffSheet.createRow(rowIndex);
for (OfficeData office : offices) { for (OfficeData office : offices) {
startIndex = rowIndex + 1; startIndex = rowIndex + 1;
writeString(OFFICE_NAME_COL, row, office.name().trim().replaceAll("[ )(]", "_")); writeString(OFFICE_NAME_COL, row, office.getName().trim().replaceAll("[ )(]", "_"));
List<StaffData> staffList = officeToPersonnel.get(office.name().trim().replaceAll("[ )(]", "_")); List<StaffData> staffList = officeToPersonnel.get(office.getName().trim().replaceAll("[ )(]", "_"));
if (staffList != null) { if (staffList != null) {
if (!staffList.isEmpty()) { if (!staffList.isEmpty()) {
@@ -125,7 +125,7 @@ public class RecurringDepositProductSheetPopulator extends AbstractWorkbookPopul
writeString(LOCKIN_PERIOD_FREQUENCY_COL, row, product.getLockinPeriodFrequencyType().getValue()); writeString(LOCKIN_PERIOD_FREQUENCY_COL, row, product.getLockinPeriodFrequencyType().getValue());
} }
CurrencyData currency = product.getCurrency(); CurrencyData currency = product.getCurrency();
writeString(CURRENCY_COL, row, currency.code()); writeString(CURRENCY_COL, row, currency.getCode());
} }
productSheet.protectSheet(""); productSheet.protectSheet("");
} }
@@ -53,9 +53,9 @@ public class SavingsAccountSheetPopulator extends AbstractWorkbookPopulator {
int rowIndex = 1; int rowIndex = 1;
for (SavingsAccountData savings : savingsAccountDataList) { for (SavingsAccountData savings : savingsAccountDataList) {
Row row = savingsSheet.createRow(rowIndex++); Row row = savingsSheet.createRow(rowIndex++);
writeLong(SAVINGS_ACCOUNT_ID_COL, row, savings.id()); writeLong(SAVINGS_ACCOUNT_ID_COL, row, savings.getId());
writeString(SAVING_ACCOUNT_NO, row, savings.getAccountNo()); writeString(SAVING_ACCOUNT_NO, row, savings.getAccountNo());
writeString(CURRENCY_COL, row, savings.currency().code()); writeString(CURRENCY_COL, row, savings.getCurrency().getCode());
writeString(CLIENT_NAME, row, savings.getClientName()); writeString(CLIENT_NAME, row, savings.getClientName());
} }
} }
@@ -79,10 +79,10 @@ public class SavingsProductSheetPopulator extends AbstractWorkbookPopulator {
writeString(LOCKIN_PERIOD_FREQUENCY_COL, row, product.getLockinPeriodFrequencyType().getValue()); writeString(LOCKIN_PERIOD_FREQUENCY_COL, row, product.getLockinPeriodFrequencyType().getValue());
} }
CurrencyData currency = product.getCurrency(); CurrencyData currency = product.getCurrency();
writeString(CURRENCY_COL, row, currency.code()); writeString(CURRENCY_COL, row, currency.getCode());
writeInt(DECIMAL_PLACES_COL, row, currency.decimalPlaces()); writeInt(DECIMAL_PLACES_COL, row, currency.getDecimalPlaces());
if (currency.currencyInMultiplesOf() != null) { if (currency.getInMultiplesOf() != null) {
writeInt(IN_MULTIPLES_OF_COL, row, currency.currencyInMultiplesOf()); writeInt(IN_MULTIPLES_OF_COL, row, currency.getInMultiplesOf());
} }
writeBoolean(WITHDRAWAL_FEE_COL, row, product.isWithdrawalFeeForTransfers()); writeBoolean(WITHDRAWAL_FEE_COL, row, product.isWithdrawalFeeForTransfers());
writeBoolean(ALLOW_OVERDRAFT_COL, row, product.isAllowOverdraft()); writeBoolean(ALLOW_OVERDRAFT_COL, row, product.isAllowOverdraft());
@@ -76,9 +76,9 @@ public class SharedProductsSheetPopulator extends AbstractWorkbookPopulator {
writeLong(PRODUCT_ID, row, productData.getId()); writeLong(PRODUCT_ID, row, productData.getId());
writeString(PRODUCT_NAME_COL, row, productData.getName().replaceAll("[ ]", "_")); writeString(PRODUCT_NAME_COL, row, productData.getName().replaceAll("[ ]", "_"));
writeString(CURRENCY_COL, row, productData.getCurrency().getName().replaceAll("[ ]", "_")); writeString(CURRENCY_COL, row, productData.getCurrency().getName().replaceAll("[ ]", "_"));
writeInt(DECIMAL_PLACES_COL, row, productData.getCurrency().decimalPlaces()); writeInt(DECIMAL_PLACES_COL, row, productData.getCurrency().getDecimalPlaces());
writeBigDecimal(TODAYS_PRICE_COL, row, deriveMarketPrice(productData)); writeBigDecimal(TODAYS_PRICE_COL, row, deriveMarketPrice(productData));
writeInt(CURRENCY_IN_MULTIPLES_COL, row, productData.getCurrency().currencyInMultiplesOf()); writeInt(CURRENCY_IN_MULTIPLES_COL, row, productData.getCurrency().getInMultiplesOf());
if (chargesForSharedProducts != null) { if (chargesForSharedProducts != null) {
int chargeRowIndex = 0; int chargeRowIndex = 0;
for (ChargeData chargeData : chargesForSharedProducts) { for (ChargeData chargeData : chargesForSharedProducts) {
@@ -101,7 +101,7 @@ public class SharedProductsSheetPopulator extends AbstractWorkbookPopulator {
if (marketDataSet != null && !marketDataSet.isEmpty()) { if (marketDataSet != null && !marketDataSet.isEmpty()) {
LocalDate currentDate = DateUtils.getBusinessLocalDate(); LocalDate currentDate = DateUtils.getBusinessLocalDate();
for (ShareProductMarketPriceData data : marketDataSet) { for (ShareProductMarketPriceData data : marketDataSet) {
LocalDate futureDate = data.getStartDate(); LocalDate futureDate = data.getFromDate();
if (currentDate.isAfter(futureDate)) { if (currentDate.isAfter(futureDate)) {
marketValue = data.getShareValue(); marketValue = data.getShareValue();
} }
@@ -226,7 +226,7 @@ public class CentersWorkbookPopulator extends AbstractWorkbookPopulator {
Integer[] officeNameToBeginEndIndexesOfStaff = personnelSheetPopulator.getOfficeNameToBeginEndIndexesOfStaff().get(i); Integer[] officeNameToBeginEndIndexesOfStaff = personnelSheetPopulator.getOfficeNameToBeginEndIndexesOfStaff().get(i);
Name loanOfficerName = centerWorkbook.createName(); Name loanOfficerName = centerWorkbook.createName();
if (officeNameToBeginEndIndexesOfStaff != null) { if (officeNameToBeginEndIndexesOfStaff != null) {
loanOfficerName.setNameName("Staff_" + offices.get(i).name().trim().replaceAll("[ )(]", "_")); loanOfficerName.setNameName("Staff_" + offices.get(i).getName().trim().replaceAll("[ )(]", "_"));
loanOfficerName.setRefersToFormula(TemplatePopulateImportConstants.STAFF_SHEET_NAME + "!$B$" loanOfficerName.setRefersToFormula(TemplatePopulateImportConstants.STAFF_SHEET_NAME + "!$B$"
+ officeNameToBeginEndIndexesOfStaff[0] + ":$B$" + officeNameToBeginEndIndexesOfStaff[1]); + officeNameToBeginEndIndexesOfStaff[0] + ":$B$" + officeNameToBeginEndIndexesOfStaff[1]);
} }
@@ -95,7 +95,7 @@ public class ChartOfAccountsWorkbook extends AbstractWorkbookPopulator {
String[] currencyCode = new String[currencies.size()]; String[] currencyCode = new String[currencies.size()];
int currencyIndex = 0; int currencyIndex = 0;
for (CurrencyData currencies : currencies) { for (CurrencyData currencies : currencies) {
currencyCode[currencyIndex] = currencies.code(); currencyCode[currencyIndex] = currencies.getCode();
currencyIndex++; currencyIndex++;
} }
return currencyCode; return currencyCode;
@@ -246,13 +246,13 @@ public class ChartOfAccountsWorkbook extends AbstractWorkbookPopulator {
startIndex = rowIndex + 1; startIndex = rowIndex + 1;
if (chartOfAccountsSheet.getRow(rowIndex) != null) { if (chartOfAccountsSheet.getRow(rowIndex) != null) {
Row row = chartOfAccountsSheet.getRow(rowIndex); Row row = chartOfAccountsSheet.getRow(rowIndex);
writeString(ChartOfAcountsConstants.LOOKUP_OFFICE_COL, row, office.name()); writeString(ChartOfAcountsConstants.LOOKUP_OFFICE_COL, row, office.getName());
writeLong(ChartOfAcountsConstants.LOOKUP_OFFICE_ID_COL, row, office.getId()); writeLong(ChartOfAcountsConstants.LOOKUP_OFFICE_ID_COL, row, office.getId());
rowIndex++; rowIndex++;
} else { } else {
Row row = chartOfAccountsSheet.createRow(rowIndex); Row row = chartOfAccountsSheet.createRow(rowIndex);
writeString(ChartOfAcountsConstants.LOOKUP_OFFICE_COL, row, office.name()); writeString(ChartOfAcountsConstants.LOOKUP_OFFICE_COL, row, office.getName());
writeLong(ChartOfAcountsConstants.LOOKUP_OFFICE_ID_COL, row, office.getId()); writeLong(ChartOfAcountsConstants.LOOKUP_OFFICE_ID_COL, row, office.getId());
rowIndex++; rowIndex++;
} }
@@ -368,7 +368,7 @@ public class ClientEntityWorkbookPopulator extends AbstractWorkbookPopulator {
Integer[] officeNameToBeginEndIndexesOfStaff = personnelSheetPopulator.getOfficeNameToBeginEndIndexesOfStaff().get(i); Integer[] officeNameToBeginEndIndexesOfStaff = personnelSheetPopulator.getOfficeNameToBeginEndIndexesOfStaff().get(i);
if (officeNameToBeginEndIndexesOfStaff != null) { if (officeNameToBeginEndIndexesOfStaff != null) {
Name name = clientWorkbook.createName(); Name name = clientWorkbook.createName();
setSanitized(name, "Staff_" + offices.get(i).name()); setSanitized(name, "Staff_" + offices.get(i).getName());
name.setRefersToFormula(TemplatePopulateImportConstants.STAFF_SHEET_NAME + "!$B$" + officeNameToBeginEndIndexesOfStaff[0] name.setRefersToFormula(TemplatePopulateImportConstants.STAFF_SHEET_NAME + "!$B$" + officeNameToBeginEndIndexesOfStaff[0]
+ ":$B$" + officeNameToBeginEndIndexesOfStaff[1]); + ":$B$" + officeNameToBeginEndIndexesOfStaff[1]);
} }
@@ -340,7 +340,7 @@ public class ClientPersonWorkbookPopulator extends AbstractWorkbookPopulator {
Integer[] officeNameToBeginEndIndexesOfStaff = personnelSheetPopulator.getOfficeNameToBeginEndIndexesOfStaff().get(i); Integer[] officeNameToBeginEndIndexesOfStaff = personnelSheetPopulator.getOfficeNameToBeginEndIndexesOfStaff().get(i);
if (officeNameToBeginEndIndexesOfStaff != null) { if (officeNameToBeginEndIndexesOfStaff != null) {
Name name = clientWorkbook.createName(); Name name = clientWorkbook.createName();
setSanitized(name, "Staff_" + offices.get(i).name()); setSanitized(name, "Staff_" + offices.get(i).getName());
name.setRefersToFormula(TemplatePopulateImportConstants.STAFF_SHEET_NAME + "!$B$" + officeNameToBeginEndIndexesOfStaff[0] name.setRefersToFormula(TemplatePopulateImportConstants.STAFF_SHEET_NAME + "!$B$" + officeNameToBeginEndIndexesOfStaff[0]
+ ":$B$" + officeNameToBeginEndIndexesOfStaff[1]); + ":$B$" + officeNameToBeginEndIndexesOfStaff[1]);
} }
@@ -241,12 +241,12 @@ public class GroupsWorkbookPopulator extends AbstractWorkbookPopulator {
Name centerName = centerWorkbook.createName(); Name centerName = centerWorkbook.createName();
if (officeNameToBeginEndIndexesOfStaff != null) { if (officeNameToBeginEndIndexesOfStaff != null) {
setSanitized(loanOfficerName, "Staff_" + offices.get(i).name()); setSanitized(loanOfficerName, "Staff_" + offices.get(i).getName());
loanOfficerName.setRefersToFormula(TemplatePopulateImportConstants.STAFF_SHEET_NAME + "!$B$" loanOfficerName.setRefersToFormula(TemplatePopulateImportConstants.STAFF_SHEET_NAME + "!$B$"
+ officeNameToBeginEndIndexesOfStaff[0] + ":$B$" + officeNameToBeginEndIndexesOfStaff[1]); + officeNameToBeginEndIndexesOfStaff[0] + ":$B$" + officeNameToBeginEndIndexesOfStaff[1]);
} }
if (officeNameToBeginEndIndexesOfCenters != null) { if (officeNameToBeginEndIndexesOfCenters != null) {
setSanitized(centerName, "Center_" + offices.get(i).name()); setSanitized(centerName, "Center_" + offices.get(i).getName());
centerName.setRefersToFormula(TemplatePopulateImportConstants.CENTER_SHEET_NAME + "!$B$" centerName.setRefersToFormula(TemplatePopulateImportConstants.CENTER_SHEET_NAME + "!$B$"
+ officeNameToBeginEndIndexesOfCenters[0] + ":$B$" + officeNameToBeginEndIndexesOfCenters[1]); + officeNameToBeginEndIndexesOfCenters[0] + ":$B$" + officeNameToBeginEndIndexesOfCenters[1]);
} }
@@ -56,7 +56,7 @@ public class OfficeWorkbookPopulator extends AbstractWorkbookPopulator {
int rowIndex = 1; int rowIndex = 1;
for (OfficeData office : offices) { for (OfficeData office : offices) {
Row row = officeSheet.createRow(rowIndex); Row row = officeSheet.createRow(rowIndex);
writeString(OfficeConstants.LOOKUP_OFFICE_COL, row, office.name()); writeString(OfficeConstants.LOOKUP_OFFICE_COL, row, office.getName());
writeLong(OfficeConstants.LOOKUP_OFFICE_ID_COL, row, office.getId()); writeLong(OfficeConstants.LOOKUP_OFFICE_ID_COL, row, office.getId());
rowIndex++; rowIndex++;
} }
@@ -404,7 +404,7 @@ public class SavingsWorkbookPopulator extends AbstractWorkbookPopulator {
setSanitized(lockinPeriodFrequencyName, "Lockin_Frequency_" + productName); setSanitized(lockinPeriodFrequencyName, "Lockin_Frequency_" + productName);
lockinPeriodFrequencyName.setRefersToFormula(TemplatePopulateImportConstants.PRODUCT_SHEET_NAME + "!$J$" + (i + 2)); lockinPeriodFrequencyName.setRefersToFormula(TemplatePopulateImportConstants.PRODUCT_SHEET_NAME + "!$J$" + (i + 2));
} }
if (product.getCurrency().currencyInMultiplesOf() != null) { if (product.getCurrency().getInMultiplesOf() != null) {
setSanitized(inMultiplesOfName, "In_Multiples_" + productName); setSanitized(inMultiplesOfName, "In_Multiples_" + productName);
inMultiplesOfName.setRefersToFormula(TemplatePopulateImportConstants.PRODUCT_SHEET_NAME + "!$M$" + (i + 2)); inMultiplesOfName.setRefersToFormula(TemplatePopulateImportConstants.PRODUCT_SHEET_NAME + "!$M$" + (i + 2));
} }
@@ -105,7 +105,7 @@ public class UserWorkbookPopulator extends AbstractWorkbookPopulator {
Name userOfficeName = userWorkbook.createName(); Name userOfficeName = userWorkbook.createName();
if (officeNameToBeginEndIndexesOfStaff != null) { if (officeNameToBeginEndIndexesOfStaff != null) {
setSanitized(userOfficeName, "Staff_" + offices.get(i).name()); setSanitized(userOfficeName, "Staff_" + offices.get(i).getName());
userOfficeName.setRefersToFormula(TemplatePopulateImportConstants.STAFF_SHEET_NAME + "!$B$" userOfficeName.setRefersToFormula(TemplatePopulateImportConstants.STAFF_SHEET_NAME + "!$B$"
+ officeNameToBeginEndIndexesOfStaff[0] + ":$B$" + officeNameToBeginEndIndexesOfStaff[1]); + officeNameToBeginEndIndexesOfStaff[0] + ":$B$" + officeNameToBeginEndIndexesOfStaff[1]);
} }
@@ -19,20 +19,17 @@
package org.apache.fineract.infrastructure.codes.data; package org.apache.fineract.infrastructure.codes.data;
import java.io.Serializable; import java.io.Serializable;
import lombok.Getter;
/** /**
* Immutable data object represent code-value data in system. * Immutable data object represent code-value data in system.
*/ */
@Getter
public class CodeValueData implements Serializable { public class CodeValueData implements Serializable {
private final Long id; private final Long id;
private final String name; private final String name;
@SuppressWarnings("unused")
private final Integer position; private final Integer position;
@SuppressWarnings("unused")
private final String description; private final String description;
private final boolean active; private final boolean active;
private final boolean mandatory; private final boolean mandatory;
@@ -88,26 +85,4 @@ public class CodeValueData implements Serializable {
this.active = active; this.active = active;
this.mandatory = mandatory; this.mandatory = mandatory;
} }
public Long getId() {
return this.id;
}
public String getName() {
return this.name;
}
/**
* @return the mandatory
*/
public boolean isMandatory() {
return mandatory;
}
/**
* @return the active
*/
public boolean isActive() {
return active;
}
} }
@@ -21,12 +21,14 @@ package org.apache.fineract.infrastructure.core.data;
import java.io.Serializable; import java.io.Serializable;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import lombok.Getter;
import lombok.ToString; import lombok.ToString;
/** /**
* Represents the successful result of an REST API call that results in processing a command. * Represents the successful result of an REST API call that results in processing a command.
*/ */
@ToString @ToString
@Getter
public class CommandProcessingResult implements Serializable { public class CommandProcessingResult implements Serializable {
private Long commandId; private Long commandId;
@@ -171,46 +173,10 @@ public class CommandProcessingResult implements Serializable {
this(commandId, officeId, null, clientId, null, null, null, resourceId, null, changesOnly, null, null, null, null, null, null); this(commandId, officeId, null, clientId, null, null, null, resourceId, null, changesOnly, null, null, null, null, null, null);
} }
public Long commandId() {
return this.commandId;
}
public Long resourceId() {
return this.resourceId;
}
public Long getOfficeId() {
return this.officeId;
}
public void setOfficeId(final Long officeId) { public void setOfficeId(final Long officeId) {
this.officeId = officeId; this.officeId = officeId;
} }
public Long getGroupId() {
return this.groupId;
}
public Long getClientId() {
return this.clientId;
}
public Long getLoanId() {
return this.loanId;
}
public Long getSavingsId() {
return this.savingsId;
}
public String getTransactionId() {
return this.transactionId;
}
public Map<String, Object> getCreditReport() {
return this.creditBureauReportData;
}
public Map<String, Object> getChanges() { public Map<String, Object> getChanges() {
Map<String, Object> checkIfEmpty = null; Map<String, Object> checkIfEmpty = null;
if (this.changes != null && !this.changes.isEmpty()) { if (this.changes != null && !this.changes.isEmpty()) {
@@ -224,18 +190,6 @@ public class CommandProcessingResult implements Serializable {
return !noChanges; return !noChanges;
} }
public Long getProductId() {
return this.productId;
}
public Long getGsimId() {
return this.gsimId;
}
public Long getGlimId() {
return this.glimId;
}
public boolean isRollbackTransaction() { public boolean isRollbackTransaction() {
return this.rollbackTransaction != null && this.rollbackTransaction; return this.rollbackTransaction != null && this.rollbackTransaction;
} }
@@ -243,8 +197,4 @@ public class CommandProcessingResult implements Serializable {
public void setRollbackTransaction(Boolean rollbackTransaction) { public void setRollbackTransaction(Boolean rollbackTransaction) {
this.rollbackTransaction = rollbackTransaction; this.rollbackTransaction = rollbackTransaction;
} }
public Long getSubResourceId() {
return subResourceId;
}
} }
@@ -19,51 +19,21 @@
package org.apache.fineract.infrastructure.core.data; package org.apache.fineract.infrastructure.core.data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects; import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
/** /**
* <p> * <p>
* Immutable data object representing generic enumeration value. * Immutable data object representing generic enumeration value.
* </p> * </p>
*/ */
@Getter
@EqualsAndHashCode
@AllArgsConstructor
public class EnumOptionData implements Serializable { public class EnumOptionData implements Serializable {
private final Long id; private final Long id;
private final String code; private final String code;
private final String value; private final String value;
public EnumOptionData(final Long id, final String code, final String value) {
this.id = id;
this.code = code;
this.value = value;
}
public Long getId() {
return this.id;
}
public String getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof EnumOptionData)) {
return false;
}
EnumOptionData that = (EnumOptionData) o;
return id.equals(that.id) && code.equals(that.code) && value.equals(that.value);
}
@Override
public int hashCode() {
return Objects.hash(id, code, value);
}
} }
@@ -19,10 +19,11 @@
package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.client; package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.client;
import org.apache.fineract.avro.client.v1.ClientDataV1; import org.apache.fineract.avro.client.v1.ClientDataV1;
import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.support.AvroMapperConfig;
import org.apache.fineract.portfolio.client.data.ClientData; import org.apache.fineract.portfolio.client.data.ClientData;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
@Mapper(componentModel = "spring") @Mapper(config = AvroMapperConfig.class)
public interface ClientDataMapper { public interface ClientDataMapper {
ClientDataV1 map(ClientData source); ClientDataV1 map(ClientData source);
@@ -19,10 +19,11 @@
package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.fixeddeposit; package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.fixeddeposit;
import org.apache.fineract.avro.fixeddeposit.v1.FixedDepositAccountDataV1; import org.apache.fineract.avro.fixeddeposit.v1.FixedDepositAccountDataV1;
import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.support.AvroMapperConfig;
import org.apache.fineract.portfolio.savings.data.FixedDepositAccountData; import org.apache.fineract.portfolio.savings.data.FixedDepositAccountData;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
@Mapper(componentModel = "spring") @Mapper(config = AvroMapperConfig.class)
public interface FixedDepositAccountDataMapper { public interface FixedDepositAccountDataMapper {
FixedDepositAccountDataV1 map(FixedDepositAccountData source); FixedDepositAccountDataV1 map(FixedDepositAccountData source);
@@ -20,9 +20,10 @@ package org.apache.fineract.infrastructure.event.external.service.serialization.
import org.apache.fineract.avro.generic.v1.CommandProcessingResultV1; import org.apache.fineract.avro.generic.v1.CommandProcessingResultV1;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.support.AvroMapperConfig;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
@Mapper(componentModel = "spring") @Mapper(config = AvroMapperConfig.class)
public interface CommandProcessingResultMapper { public interface CommandProcessingResultMapper {
CommandProcessingResultV1 map(CommandProcessingResult source); CommandProcessingResultV1 map(CommandProcessingResult source);
@@ -19,10 +19,11 @@
package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.loan; package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.loan;
import org.apache.fineract.avro.loan.v1.LoanAccountDataV1; import org.apache.fineract.avro.loan.v1.LoanAccountDataV1;
import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.support.AvroMapperConfig;
import org.apache.fineract.portfolio.loanaccount.data.LoanAccountData; import org.apache.fineract.portfolio.loanaccount.data.LoanAccountData;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
@Mapper(componentModel = "spring") @Mapper(config = AvroMapperConfig.class)
public interface LoanAccountDataMapper { public interface LoanAccountDataMapper {
LoanAccountDataV1 map(LoanAccountData source); LoanAccountDataV1 map(LoanAccountData source);
@@ -19,10 +19,11 @@
package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.loan; package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.loan;
import org.apache.fineract.avro.loan.v1.LoanChargeDataV1; import org.apache.fineract.avro.loan.v1.LoanChargeDataV1;
import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.support.AvroMapperConfig;
import org.apache.fineract.portfolio.loanaccount.data.LoanChargeData; import org.apache.fineract.portfolio.loanaccount.data.LoanChargeData;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
@Mapper(componentModel = "spring") @Mapper(config = AvroMapperConfig.class)
public interface LoanChargeDataMapper { public interface LoanChargeDataMapper {
LoanChargeDataV1 map(LoanChargeData source); LoanChargeDataV1 map(LoanChargeData source);
@@ -19,10 +19,11 @@
package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.loan; package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.loan;
import org.apache.fineract.avro.loan.v1.LoanProductDataV1; import org.apache.fineract.avro.loan.v1.LoanProductDataV1;
import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.support.AvroMapperConfig;
import org.apache.fineract.portfolio.loanproduct.data.LoanProductData; import org.apache.fineract.portfolio.loanproduct.data.LoanProductData;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
@Mapper(componentModel = "spring") @Mapper(config = AvroMapperConfig.class)
public interface LoanProductDataMapper { public interface LoanProductDataMapper {
LoanProductDataV1 map(LoanProductData source); LoanProductDataV1 map(LoanProductData source);
@@ -19,10 +19,11 @@
package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.loan; package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.loan;
import org.apache.fineract.avro.loan.v1.LoanTransactionDataV1; import org.apache.fineract.avro.loan.v1.LoanTransactionDataV1;
import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.support.AvroMapperConfig;
import org.apache.fineract.portfolio.loanaccount.data.LoanTransactionData; import org.apache.fineract.portfolio.loanaccount.data.LoanTransactionData;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
@Mapper(componentModel = "spring") @Mapper(config = AvroMapperConfig.class)
public interface LoanTransactionDataMapper { public interface LoanTransactionDataMapper {
LoanTransactionDataV1 map(LoanTransactionData source); LoanTransactionDataV1 map(LoanTransactionData source);
@@ -19,10 +19,11 @@
package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.recurringdeposit; package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.recurringdeposit;
import org.apache.fineract.avro.recurringdeposit.v1.RecurringDepositAccountDataV1; import org.apache.fineract.avro.recurringdeposit.v1.RecurringDepositAccountDataV1;
import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.support.AvroMapperConfig;
import org.apache.fineract.portfolio.savings.data.RecurringDepositAccountData; import org.apache.fineract.portfolio.savings.data.RecurringDepositAccountData;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
@Mapper(componentModel = "spring") @Mapper(config = AvroMapperConfig.class)
public interface RecurringDepositAccountDataMapper { public interface RecurringDepositAccountDataMapper {
RecurringDepositAccountDataV1 map(RecurringDepositAccountData source); RecurringDepositAccountDataV1 map(RecurringDepositAccountData source);
@@ -19,10 +19,11 @@
package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.savings; package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.savings;
import org.apache.fineract.avro.savings.v1.SavingsAccountDataV1; import org.apache.fineract.avro.savings.v1.SavingsAccountDataV1;
import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.support.AvroMapperConfig;
import org.apache.fineract.portfolio.savings.data.SavingsAccountData; import org.apache.fineract.portfolio.savings.data.SavingsAccountData;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
@Mapper(componentModel = "spring") @Mapper(config = AvroMapperConfig.class)
public interface SavingsAccountDataMapper { public interface SavingsAccountDataMapper {
SavingsAccountDataV1 map(SavingsAccountData source); SavingsAccountDataV1 map(SavingsAccountData source);
@@ -19,10 +19,11 @@
package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.savings; package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.savings;
import org.apache.fineract.avro.savings.v1.SavingsAccountTransactionDataV1; import org.apache.fineract.avro.savings.v1.SavingsAccountTransactionDataV1;
import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.support.AvroMapperConfig;
import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionData; import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionData;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
@Mapper(componentModel = "spring") @Mapper(config = AvroMapperConfig.class)
public interface SavingsAccountTransactionDataMapper { public interface SavingsAccountTransactionDataMapper {
SavingsAccountTransactionDataV1 map(SavingsAccountTransactionData source); SavingsAccountTransactionDataV1 map(SavingsAccountTransactionData source);
@@ -19,10 +19,11 @@
package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.share; package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.share;
import org.apache.fineract.avro.share.v1.ShareAccountDataV1; import org.apache.fineract.avro.share.v1.ShareAccountDataV1;
import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.support.AvroMapperConfig;
import org.apache.fineract.portfolio.shareaccounts.data.ShareAccountData; import org.apache.fineract.portfolio.shareaccounts.data.ShareAccountData;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
@Mapper(componentModel = "spring") @Mapper(config = AvroMapperConfig.class)
public interface ShareAccountDataMapper { public interface ShareAccountDataMapper {
ShareAccountDataV1 map(ShareAccountData source); ShareAccountDataV1 map(ShareAccountData source);
@@ -19,10 +19,11 @@
package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.share; package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.share;
import org.apache.fineract.avro.share.v1.ShareProductDataV1; import org.apache.fineract.avro.share.v1.ShareProductDataV1;
import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.support.AvroMapperConfig;
import org.apache.fineract.portfolio.shareproducts.data.ShareProductData; import org.apache.fineract.portfolio.shareproducts.data.ShareProductData;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
@Mapper(componentModel = "spring") @Mapper(config = AvroMapperConfig.class)
public interface ShareProductDataMapper { public interface ShareProductDataMapper {
ShareProductDataV1 map(ShareProductData source); ShareProductDataV1 map(ShareProductData source);
@@ -0,0 +1,50 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.support;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import org.springframework.stereotype.Component;
@Component
public class AvroDateTimeMapper {
public String mapOffsetDateTime(OffsetDateTime source) {
if (source == null) {
return null;
}
return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(source);
}
public String mapLocalDateTime(LocalDateTime source) {
if (source == null) {
return null;
}
return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(source);
}
public String mapLocalDate(LocalDate source) {
if (source == null) {
return null;
}
return DateTimeFormatter.ISO_LOCAL_DATE.format(source);
}
}
@@ -0,0 +1,28 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.support;
import org.mapstruct.Builder;
import org.mapstruct.MapperConfig;
import org.mapstruct.MappingConstants;
import org.mapstruct.ReportingPolicy;
@MapperConfig(componentModel = MappingConstants.ComponentModel.SPRING, unmappedTargetPolicy = ReportingPolicy.ERROR, builder = @Builder(disableBuilder = true), uses = {
AvroDateTimeMapper.class, AvroMonthDayMapper.class })
public class AvroMapperConfig {}
@@ -0,0 +1,33 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.fineract.infrastructure.event.external.service.serialization.mapper.support;
import java.time.MonthDay;
import org.springframework.stereotype.Component;
@Component
public class AvroMonthDayMapper {
public String mapMonthDay(MonthDay source) {
if (source == null) {
return null;
}
return source.toString();
}
}
@@ -19,11 +19,14 @@
package org.apache.fineract.organisation.monetary.data; package org.apache.fineract.organisation.monetary.data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects; import lombok.EqualsAndHashCode;
import lombok.Getter;
/** /**
* Immutable data object representing currency. * Immutable data object representing currency.
*/ */
@Getter
@EqualsAndHashCode
public class CurrencyData implements Serializable { public class CurrencyData implements Serializable {
private final String code; private final String code;
@@ -31,9 +34,7 @@ public class CurrencyData implements Serializable {
private final int decimalPlaces; private final int decimalPlaces;
private final Integer inMultiplesOf; private final Integer inMultiplesOf;
private final String displaySymbol; private final String displaySymbol;
@SuppressWarnings("unused")
private final String nameCode; private final String nameCode;
@SuppressWarnings("unused")
private final String displayLabel; private final String displayLabel;
public static CurrencyData blank() { public static CurrencyData blank() {
@@ -71,18 +72,6 @@ public class CurrencyData implements Serializable {
this.displayLabel = null; this.displayLabel = null;
} }
public String code() {
return this.code;
}
public int decimalPlaces() {
return this.decimalPlaces;
}
public Integer currencyInMultiplesOf() {
return this.inMultiplesOf;
}
private String generateDisplayLabel() { private String generateDisplayLabel() {
final StringBuilder builder = new StringBuilder(this.name).append(' '); final StringBuilder builder = new StringBuilder(this.name).append(' ');
@@ -95,39 +84,4 @@ public class CurrencyData implements Serializable {
return builder.toString(); return builder.toString();
} }
public String getName() {
return name;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof CurrencyData)) {
return false;
}
CurrencyData that = (CurrencyData) o;
return (decimalPlaces == that.decimalPlaces) && Objects.equals(code, that.code) && Objects.equals(name, that.name)
&& Objects.equals(inMultiplesOf, that.inMultiplesOf) && Objects.equals(displaySymbol, that.displaySymbol)
&& Objects.equals(nameCode, that.nameCode) && Objects.equals(displayLabel, that.displayLabel);
}
@Override
public int hashCode() {
return Objects.hash(code, name, decimalPlaces, inMultiplesOf, displaySymbol, nameCode, displayLabel);
}
public String getCode() {
return this.code;
}
public int getDecimalPlaces() {
return this.decimalPlaces;
}
public Integer getInMultiplesOf() {
return this.inMultiplesOf;
}
} }
@@ -22,10 +22,12 @@ import java.io.Serializable;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import lombok.Getter;
/** /**
* Immutable data object for office data. * Immutable data object for office data.
*/ */
@Getter
public class OfficeData implements Serializable { public class OfficeData implements Serializable {
private final Long id; private final Long id;
@@ -36,7 +38,6 @@ public class OfficeData implements Serializable {
private final String hierarchy; private final String hierarchy;
private final Long parentId; private final Long parentId;
private final String parentName; private final String parentName;
@SuppressWarnings("unused")
private final Collection<OfficeData> allowedParents; private final Collection<OfficeData> allowedParents;
// import fields // import fields
@@ -58,18 +59,6 @@ public class OfficeData implements Serializable {
return new OfficeData(id, name, null, null, null, null, null, null, null); return new OfficeData(id, name, null, null, null, null, null, null, null);
} }
public LocalDate getOpeningDate() {
return openingDate;
}
public Integer getRowIndex() {
return rowIndex;
}
public Long getId() {
return id;
}
public static OfficeData dropdown(final Long id, final String name, final String nameDecorated) { public static OfficeData dropdown(final Long id, final String name, final String nameDecorated) {
return new OfficeData(id, name, nameDecorated, null, null, null, null, null, null); return new OfficeData(id, name, nameDecorated, null, null, null, null, null, null);
} }
@@ -99,12 +88,4 @@ public class OfficeData implements Serializable {
public boolean hasIdentifyOf(final Long officeId) { public boolean hasIdentifyOf(final Long officeId) {
return this.id.equals(officeId); return this.id.equals(officeId);
} }
public String name() {
return this.name;
}
public String getHierarchy() {
return this.hierarchy;
}
} }
@@ -369,7 +369,7 @@ public class TellerManagementReadPlatformServiceImpl implements TellerManagement
final OfficeData officeData = this.officeReadPlatformService.retrieveOffice(defaultOfficeId); final OfficeData officeData = this.officeReadPlatformService.retrieveOffice(defaultOfficeId);
String officeName = ""; String officeName = "";
if (officeData != null) { if (officeData != null) {
officeName = officeData.name(); officeName = officeData.getName();
} }
TellerData tellerData = findTeller(tellerId); TellerData tellerData = findTeller(tellerId);
@@ -246,10 +246,10 @@ public class StandingInstructionApiResource {
} }
if (associationParameters.contains("template")) { if (associationParameters.contains("template")) {
final StandingInstructionData templateData = this.standingInstructionReadPlatformService.retrieveTemplate( final StandingInstructionData templateData = this.standingInstructionReadPlatformService.retrieveTemplate(
standingInstructionData.fromClient().officeId(), standingInstructionData.fromClient().id(), standingInstructionData.fromClient().getOfficeId(), standingInstructionData.fromClient().getId(),
standingInstructionData.fromAccount().accountId(), standingInstructionData.fromAccountType().getValue(), standingInstructionData.fromAccount().getId(), standingInstructionData.fromAccountType().getValue(),
standingInstructionData.toClient().officeId(), standingInstructionData.toClient().id(), standingInstructionData.toClient().getOfficeId(), standingInstructionData.toClient().getId(),
standingInstructionData.toAccount().accountId(), standingInstructionData.toAccountType().getValue(), standingInstructionData.toAccount().getId(), standingInstructionData.toAccountType().getValue(),
standingInstructionData.transferType().getValue()); standingInstructionData.transferType().getValue());
standingInstructionData = StandingInstructionData.withTemplateData(standingInstructionData, templateData); standingInstructionData = StandingInstructionData.withTemplateData(standingInstructionData, templateData);
} }
@@ -22,6 +22,7 @@ import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.Collection; import java.util.Collection;
import lombok.Getter;
import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.organisation.monetary.data.CurrencyData; import org.apache.fineract.organisation.monetary.data.CurrencyData;
import org.apache.fineract.organisation.office.data.OfficeData; import org.apache.fineract.organisation.office.data.OfficeData;
@@ -30,7 +31,7 @@ import org.apache.fineract.portfolio.client.data.ClientData;
/** /**
* Immutable data object representing a savings account. * Immutable data object representing a savings account.
*/ */
@SuppressWarnings("unused") @Getter
public final class AccountTransferData implements Serializable { public final class AccountTransferData implements Serializable {
private final Long id; private final Long id;
@@ -69,7 +70,7 @@ public final class AccountTransferData implements Serializable {
CurrencyData currency = null; CurrencyData currency = null;
BigDecimal transferAmount = BigDecimal.ZERO; BigDecimal transferAmount = BigDecimal.ZERO;
if (fromAccount != null) { if (fromAccount != null) {
currency = fromAccount.currency(); currency = fromAccount.getCurrency();
if (fromAccount.getAmtForTransfer() != null) { if (fromAccount.getAmtForTransfer() != null) {
transferAmount = fromAccount.getAmtForTransfer(); transferAmount = fromAccount.getAmtForTransfer();
} }
@@ -20,14 +20,17 @@ package org.apache.fineract.portfolio.account.data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.apache.commons.lang3.builder.EqualsBuilder; import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.builder.HashCodeBuilder; import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.organisation.monetary.data.CurrencyData; import org.apache.fineract.organisation.monetary.data.CurrencyData;
/** /**
* Immutable data object representing a savings account. * Immutable data object representing a savings account.
*/ */
@SuppressWarnings("unused") @Getter
@EqualsAndHashCode
@RequiredArgsConstructor
public class PortfolioAccountData implements Serializable { public class PortfolioAccountData implements Serializable {
private final Long id; private final Long id;
@@ -66,64 +69,7 @@ public class PortfolioAccountData implements Serializable {
this.amtForTransfer = null; this.amtForTransfer = null;
} }
public PortfolioAccountData(final Long id, final String accountNo, final String externalId, final Long groupId, final String groupName, public String getCurrencyCode() {
final Long clientId, final String clientName, final Long productId, final String productName, final Long fieldOfficerId, return this.currency.getCode();
final String fieldOfficerName, final CurrencyData currency, final BigDecimal amtForTransfer) {
this.id = id;
this.accountNo = accountNo;
this.externalId = externalId;
this.groupId = groupId;
this.groupName = groupName;
this.clientId = clientId;
this.clientName = clientName;
this.productId = productId;
this.productName = productName;
this.fieldOfficerId = fieldOfficerId;
this.fieldOfficerName = fieldOfficerName;
this.currency = currency;
this.amtForTransfer = amtForTransfer;
}
@Override
public boolean equals(final Object obj) {
if (obj == null) {
return false;
}
if (obj == this) {
return true;
}
if (!(obj instanceof PortfolioAccountData)) {
return false;
}
final PortfolioAccountData rhs = (PortfolioAccountData) obj;
return new EqualsBuilder().append(this.id, rhs.id).append(this.accountNo, rhs.accountNo).append(this.productId, rhs.productId)
.append(this.productName, rhs.productName).isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37).append(this.id).append(this.accountNo).append(this.productId).append(this.productName)
.toHashCode();
}
public Long clientId() {
return this.clientId;
}
public CurrencyData currency() {
return this.currency;
}
public String currencyCode() {
return this.currency.code();
}
public BigDecimal getAmtForTransfer() {
return this.amtForTransfer;
}
public Long accountId() {
return this.id;
} }
} }
@@ -91,7 +91,7 @@ public class ExecuteStandingInstructionsTasklet implements Tasklet {
if (data.toAccountType().isLoanAccount() if (data.toAccountType().isLoanAccount()
&& (recurrenceType.isDuesRecurrence() || (isDueForTransfer && instructionType.isDuesAmoutTransfer()))) { && (recurrenceType.isDuesRecurrence() || (isDueForTransfer && instructionType.isDuesAmoutTransfer()))) {
StandingInstructionDuesData standingInstructionDuesData = standingInstructionReadPlatformService StandingInstructionDuesData standingInstructionDuesData = standingInstructionReadPlatformService
.retriveLoanDuesData(data.toAccount().accountId()); .retriveLoanDuesData(data.toAccount().getId());
if (data.instructionType().isDuesAmoutTransfer()) { if (data.instructionType().isDuesAmoutTransfer()) {
transactionAmount = standingInstructionDuesData.totalDueAmount(); transactionAmount = standingInstructionDuesData.totalDueAmount();
} }
@@ -105,7 +105,7 @@ public class ExecuteStandingInstructionsTasklet implements Tasklet {
final boolean isRegularTransaction = true; final boolean isRegularTransaction = true;
final boolean isExceptionForBalanceCheck = false; final boolean isExceptionForBalanceCheck = false;
AccountTransferDTO accountTransferDTO = new AccountTransferDTO(transactionDate, transactionAmount, data.fromAccountType(), AccountTransferDTO accountTransferDTO = new AccountTransferDTO(transactionDate, transactionAmount, data.fromAccountType(),
data.toAccountType(), data.fromAccount().accountId(), data.toAccount().accountId(), data.toAccountType(), data.fromAccount().getId(), data.toAccount().getId(),
data.name() + " Standing instruction trasfer ", null, null, null, null, data.toTransferType(), null, null, data.name() + " Standing instruction trasfer ", null, null, null, null, data.toTransferType(), null, null,
data.transferType().getValue(), null, null, null, null, null, fromSavingsAccount, isRegularTransaction, data.transferType().getValue(), null, null, null, null, null, fromSavingsAccount, isRegularTransaction,
isExceptionForBalanceCheck); isExceptionForBalanceCheck);
@@ -136,12 +136,12 @@ public class AccountTransfersReadPlatformServiceImpl implements AccountTransfers
fromAccount = this.portfolioAccountReadPlatformService.retrieveOne(fromAccountId, accountType); fromAccount = this.portfolioAccountReadPlatformService.retrieveOne(fromAccountId, accountType);
// override provided fromClient with client of account // override provided fromClient with client of account
mostRelevantFromClientId = fromAccount.clientId(); mostRelevantFromClientId = fromAccount.getClientId();
} }
if (mostRelevantFromClientId != null) { if (mostRelevantFromClientId != null) {
fromClient = this.clientReadPlatformService.retrieveOne(mostRelevantFromClientId); fromClient = this.clientReadPlatformService.retrieveOne(mostRelevantFromClientId);
mostRelevantFromOfficeId = fromClient.officeId(); mostRelevantFromOfficeId = fromClient.getOfficeId();
long[] loanStatus = null; long[] loanStatus = null;
if (mostRelevantFromAccountType == 1) { if (mostRelevantFromAccountType == 1) {
loanStatus = new long[] { 300, 700 }; loanStatus = new long[] { 300, 700 };
@@ -166,13 +166,13 @@ public class AccountTransfersReadPlatformServiceImpl implements AccountTransfers
if (toAccountId != null && fromAccount != null) { if (toAccountId != null && fromAccount != null) {
toAccount = this.portfolioAccountReadPlatformService.retrieveOne(toAccountId, mostRelevantToAccountType, toAccount = this.portfolioAccountReadPlatformService.retrieveOne(toAccountId, mostRelevantToAccountType,
fromAccount.currencyCode()); fromAccount.getCurrencyCode());
mostRelevantToClientId = toAccount.clientId(); mostRelevantToClientId = toAccount.getClientId();
} }
if (mostRelevantToClientId != null) { if (mostRelevantToClientId != null) {
toClient = this.clientReadPlatformService.retrieveOne(mostRelevantToClientId); toClient = this.clientReadPlatformService.retrieveOne(mostRelevantToClientId);
mostRelevantToOfficeId = toClient.officeId(); mostRelevantToOfficeId = toClient.getOfficeId();
toClientOptions = this.clientReadPlatformService.retrieveAllForLookupByOfficeId(mostRelevantToOfficeId); toClientOptions = this.clientReadPlatformService.retrieveAllForLookupByOfficeId(mostRelevantToOfficeId);
@@ -199,7 +199,7 @@ public class AccountTransfersReadPlatformServiceImpl implements AccountTransfers
private Collection<PortfolioAccountData> retrieveToAccounts(final PortfolioAccountData excludeThisAccountFromOptions, private Collection<PortfolioAccountData> retrieveToAccounts(final PortfolioAccountData excludeThisAccountFromOptions,
final Integer toAccountType, final Long toClientId) { final Integer toAccountType, final Long toClientId) {
final String currencyCode = excludeThisAccountFromOptions != null ? excludeThisAccountFromOptions.currencyCode() : null; final String currencyCode = excludeThisAccountFromOptions != null ? excludeThisAccountFromOptions.getCurrencyCode() : null;
PortfolioAccountDTO portfolioAccountDTO = new PortfolioAccountDTO(toAccountType, toClientId, currencyCode, null, null); PortfolioAccountDTO portfolioAccountDTO = new PortfolioAccountDTO(toAccountType, toClientId, currencyCode, null, null);
Collection<PortfolioAccountData> accountOptions = this.portfolioAccountReadPlatformService Collection<PortfolioAccountData> accountOptions = this.portfolioAccountReadPlatformService
@@ -491,12 +491,12 @@ public class AccountTransfersReadPlatformServiceImpl implements AccountTransfers
fromAccount = this.portfolioAccountReadPlatformService.retrieveOneByPaidInAdvance(fromAccountId, accountType); fromAccount = this.portfolioAccountReadPlatformService.retrieveOneByPaidInAdvance(fromAccountId, accountType);
// override provided fromClient with client of account // override provided fromClient with client of account
mostRelevantFromClientId = fromAccount.clientId(); mostRelevantFromClientId = fromAccount.getClientId();
} }
if (mostRelevantFromClientId != null) { if (mostRelevantFromClientId != null) {
fromClient = this.clientReadPlatformService.retrieveOne(mostRelevantFromClientId); fromClient = this.clientReadPlatformService.retrieveOne(mostRelevantFromClientId);
mostRelevantFromOfficeId = fromClient.officeId(); mostRelevantFromOfficeId = fromClient.getOfficeId();
long[] loanStatus = null; long[] loanStatus = null;
if (mostRelevantFromAccountType == 1) { if (mostRelevantFromAccountType == 1) {
loanStatus = new long[] { 300, 700 }; loanStatus = new long[] { 300, 700 };
@@ -521,13 +521,13 @@ public class AccountTransfersReadPlatformServiceImpl implements AccountTransfers
if (toAccountId != null && fromAccount != null) { if (toAccountId != null && fromAccount != null) {
toAccount = this.portfolioAccountReadPlatformService.retrieveOne(toAccountId, mostRelevantToAccountType, toAccount = this.portfolioAccountReadPlatformService.retrieveOne(toAccountId, mostRelevantToAccountType,
fromAccount.currencyCode()); fromAccount.getCurrencyCode());
mostRelevantToClientId = toAccount.clientId(); mostRelevantToClientId = toAccount.getClientId();
} }
if (mostRelevantToClientId != null) { if (mostRelevantToClientId != null) {
toClient = this.clientReadPlatformService.retrieveOne(mostRelevantToClientId); toClient = this.clientReadPlatformService.retrieveOne(mostRelevantToClientId);
mostRelevantToOfficeId = toClient.officeId(); mostRelevantToOfficeId = toClient.getOfficeId();
toClientOptions = this.clientReadPlatformService.retrieveAllForLookupByOfficeId(mostRelevantToOfficeId); toClientOptions = this.clientReadPlatformService.retrieveAllForLookupByOfficeId(mostRelevantToOfficeId);
@@ -162,12 +162,12 @@ public class StandingInstructionReadPlatformServiceImpl implements StandingInstr
fromAccount = this.portfolioAccountReadPlatformService.retrieveOne(fromAccountId, accountType); fromAccount = this.portfolioAccountReadPlatformService.retrieveOne(fromAccountId, accountType);
// override provided fromClient with client of account // override provided fromClient with client of account
mostRelevantFromClientId = fromAccount.clientId(); mostRelevantFromClientId = fromAccount.getClientId();
} }
if (mostRelevantFromClientId != null) { if (mostRelevantFromClientId != null) {
fromClient = this.clientReadPlatformService.retrieveOne(mostRelevantFromClientId); fromClient = this.clientReadPlatformService.retrieveOne(mostRelevantFromClientId);
mostRelevantFromOfficeId = fromClient.officeId(); mostRelevantFromOfficeId = fromClient.getOfficeId();
long[] loanStatus = null; long[] loanStatus = null;
if (mostRelevantFromAccountType == 1) { if (mostRelevantFromAccountType == 1) {
loanStatus = new long[] { 300, 700 }; loanStatus = new long[] { 300, 700 };
@@ -192,13 +192,13 @@ public class StandingInstructionReadPlatformServiceImpl implements StandingInstr
if (toAccountId != null && fromAccount != null) { if (toAccountId != null && fromAccount != null) {
toAccount = this.portfolioAccountReadPlatformService.retrieveOne(toAccountId, mostRelevantToAccountType, toAccount = this.portfolioAccountReadPlatformService.retrieveOne(toAccountId, mostRelevantToAccountType,
fromAccount.currencyCode()); fromAccount.getCurrencyCode());
mostRelevantToClientId = toAccount.clientId(); mostRelevantToClientId = toAccount.getClientId();
} }
if (mostRelevantToClientId != null) { if (mostRelevantToClientId != null) {
toClient = this.clientReadPlatformService.retrieveOne(mostRelevantToClientId); toClient = this.clientReadPlatformService.retrieveOne(mostRelevantToClientId);
mostRelevantToOfficeId = toClient.officeId(); mostRelevantToOfficeId = toClient.getOfficeId();
toClientOptions = this.clientReadPlatformService.retrieveAllForLookupByOfficeId(mostRelevantToOfficeId); toClientOptions = this.clientReadPlatformService.retrieveAllForLookupByOfficeId(mostRelevantToOfficeId);
@@ -243,7 +243,7 @@ public class StandingInstructionReadPlatformServiceImpl implements StandingInstr
private Collection<PortfolioAccountData> retrieveToAccounts(final PortfolioAccountData excludeThisAccountFromOptions, private Collection<PortfolioAccountData> retrieveToAccounts(final PortfolioAccountData excludeThisAccountFromOptions,
final Integer toAccountType, final Long toClientId) { final Integer toAccountType, final Long toClientId) {
final String currencyCode = excludeThisAccountFromOptions != null ? excludeThisAccountFromOptions.currencyCode() : null; final String currencyCode = excludeThisAccountFromOptions != null ? excludeThisAccountFromOptions.getCurrencyCode() : null;
PortfolioAccountDTO portfolioAccountDTO = new PortfolioAccountDTO(toAccountType, toClientId, currencyCode, null, null); PortfolioAccountDTO portfolioAccountDTO = new PortfolioAccountDTO(toAccountType, toClientId, currencyCode, null, null);
Collection<PortfolioAccountData> accountOptions = this.portfolioAccountReadPlatformService Collection<PortfolioAccountData> accountOptions = this.portfolioAccountReadPlatformService
@@ -19,6 +19,8 @@
package org.apache.fineract.portfolio.accountdetails.data; package org.apache.fineract.portfolio.accountdetails.data;
import java.math.BigDecimal; import java.math.BigDecimal;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.portfolio.loanaccount.data.LoanApplicationTimelineData; import org.apache.fineract.portfolio.loanaccount.data.LoanApplicationTimelineData;
import org.apache.fineract.portfolio.loanaccount.data.LoanStatusEnumData; import org.apache.fineract.portfolio.loanaccount.data.LoanStatusEnumData;
@@ -26,7 +28,8 @@ import org.apache.fineract.portfolio.loanaccount.data.LoanStatusEnumData;
/** /**
* Immutable data object for loan accounts. * Immutable data object for loan accounts.
*/ */
@SuppressWarnings("unused") @Getter
@RequiredArgsConstructor
public class LoanAccountSummaryData { public class LoanAccountSummaryData {
private final Long id; private final Long id;
@@ -66,24 +69,4 @@ public class LoanAccountSummaryData {
this.amountPaid = amountPaid; this.amountPaid = amountPaid;
} }
public LoanAccountSummaryData(final Long id, final String accountNo, final String parentAccountNumber, final String externalId,
final Long productId, final String loanProductName, final String shortLoanProductName, final LoanStatusEnumData loanStatus,
final EnumOptionData loanType, final Integer loanCycle, final LoanApplicationTimelineData timeline, final Boolean inArrears,
final BigDecimal originalLoan, final BigDecimal loanBalance, final BigDecimal amountPaid) {
this.id = id;
this.accountNo = accountNo;
this.parentAccountNumber = parentAccountNumber;
this.externalId = externalId;
this.productId = productId;
this.productName = loanProductName;
this.shortProductName = shortLoanProductName;
this.status = loanStatus;
this.loanType = loanType;
this.loanCycle = loanCycle;
this.timeline = timeline;
this.inArrears = inArrears;
this.loanBalance = loanBalance;
this.originalLoan = originalLoan;
this.amountPaid = amountPaid;
}
} }
@@ -19,11 +19,12 @@
package org.apache.fineract.portfolio.accountdetails.data; package org.apache.fineract.portfolio.accountdetails.data;
import java.io.Serializable; import java.io.Serializable;
import lombok.Getter;
import org.apache.fineract.organisation.monetary.data.CurrencyData; import org.apache.fineract.organisation.monetary.data.CurrencyData;
import org.apache.fineract.portfolio.shareaccounts.data.ShareAccountApplicationTimelineData; import org.apache.fineract.portfolio.shareaccounts.data.ShareAccountApplicationTimelineData;
import org.apache.fineract.portfolio.shareaccounts.data.ShareAccountStatusEnumData; import org.apache.fineract.portfolio.shareaccounts.data.ShareAccountStatusEnumData;
@SuppressWarnings("unused") @Getter
public class ShareAccountSummaryData implements Serializable { public class ShareAccountSummaryData implements Serializable {
private final Long id; private final Long id;
@@ -62,8 +63,4 @@ public class ShareAccountSummaryData implements Serializable {
this.timeline = timeline; this.timeline = timeline;
} }
public String getAccountNo() {
return this.accountNo;
}
} }
@@ -24,8 +24,8 @@ import java.time.LocalTime;
import java.time.OffsetDateTime; import java.time.OffsetDateTime;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Objects; import lombok.EqualsAndHashCode;
import org.apache.commons.collections4.CollectionUtils; import lombok.Getter;
import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.portfolio.calendar.domain.CalendarFrequencyType; import org.apache.fineract.portfolio.calendar.domain.CalendarFrequencyType;
import org.apache.fineract.portfolio.calendar.domain.CalendarRemindBy; import org.apache.fineract.portfolio.calendar.domain.CalendarRemindBy;
@@ -38,6 +38,8 @@ import org.apache.fineract.portfolio.common.domain.NthDayType;
/** /**
* Immutable data object representing a Calendar. * Immutable data object representing a Calendar.
*/ */
@Getter
@EqualsAndHashCode
public final class CalendarData implements Serializable { public final class CalendarData implements Serializable {
private final Long id; private final Long id;
@@ -375,90 +377,6 @@ public final class CalendarData implements Serializable {
this.frequencyNthDayTypeOptions = frequencyNthDayTypeOptions; this.frequencyNthDayTypeOptions = frequencyNthDayTypeOptions;
} }
public Long getId() {
return this.id;
}
public Long getEntityId() {
return this.entityId;
}
public EnumOptionData getEntityType() {
return this.entityType;
}
public String getTitle() {
return this.title;
}
public String getDescription() {
return this.description;
}
public String getLocation() {
return this.location;
}
public LocalDate getStartDate() {
return this.startDate;
}
public LocalDate getEndDate() {
return this.endDate;
}
public OffsetDateTime getCreatedDate() {
return this.createdDate;
}
public Integer getDuration() {
return this.duration;
}
public EnumOptionData getType() {
return this.type;
}
public boolean isRepeating() {
return this.repeating;
}
public String getRecurrence() {
return this.recurrence;
}
public EnumOptionData getRemindBy() {
return this.remindBy;
}
public Integer getFirstReminder() {
return this.firstReminder;
}
public Integer getSecondReminder() {
return this.secondReminder;
}
public List<EnumOptionData> getEntityTypeOptions() {
return this.entityTypeOptions;
}
public List<EnumOptionData> getCalendarTypeOptions() {
return this.calendarTypeOptions;
}
public List<EnumOptionData> getRemindByOptions() {
return this.remindByOptions;
}
public String getHumanReadable() {
return this.humanReadable;
}
public Long getCalendarInstanceId() {
return this.calendarInstanceId;
}
public boolean isStartDateBeforeOrEqual(final LocalDate compareDate) { public boolean isStartDateBeforeOrEqual(final LocalDate compareDate) {
if (this.startDate != null && compareDate != null) { if (this.startDate != null && compareDate != null) {
if (this.startDate.isBefore(compareDate) || this.startDate.equals(compareDate)) { if (this.startDate.isBefore(compareDate) || this.startDate.equals(compareDate)) {
@@ -493,66 +411,4 @@ public final class CalendarData implements Serializable {
} }
return false; return false;
} }
public Integer interval() {
return this.interval;
}
public EnumOptionData frequencyType() {
return this.frequency;
}
public EnumOptionData getRepeatsOnDay() {
return this.repeatsOnDay;
}
public EnumOptionData getRepeatsOnNthDayOfMonth() {
return this.repeatsOnNthDayOfMonth;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof CalendarData)) {
return false;
}
CalendarData that = (CalendarData) o;
return (repeating == that.repeating) && Objects.equals(id, that.id) && Objects.equals(calendarInstanceId, that.calendarInstanceId)
&& Objects.equals(entityId, that.entityId) && Objects.equals(entityType, that.entityType)
&& Objects.equals(title, that.title) && Objects.equals(description, that.description)
&& Objects.equals(location, that.location) && Objects.equals(startDate, that.startDate)
&& Objects.equals(endDate, that.endDate) && Objects.equals(meetingTime, that.meetingTime)
&& Objects.equals(duration, that.duration) && Objects.equals(type, that.type) && Objects.equals(recurrence, that.recurrence)
&& Objects.equals(frequency, that.frequency) && Objects.equals(interval, that.interval)
&& Objects.equals(repeatsOnDay, that.repeatsOnDay) && Objects.equals(repeatsOnNthDayOfMonth, that.repeatsOnNthDayOfMonth)
&& Objects.equals(remindBy, that.remindBy) && Objects.equals(firstReminder, that.firstReminder)
&& Objects.equals(secondReminder, that.secondReminder)
&& CollectionUtils.isEqualCollection(recurringDates, that.recurringDates)
&& CollectionUtils.isEqualCollection(nextTenRecurringDates, that.nextTenRecurringDates)
&& Objects.equals(humanReadable, that.humanReadable)
&& Objects.equals(recentEligibleMeetingDate, that.recentEligibleMeetingDate)
&& Objects.equals(createdDate, that.createdDate) && Objects.equals(lastUpdatedDate, that.lastUpdatedDate)
&& Objects.equals(createdByUserId, that.createdByUserId) && Objects.equals(createdByUsername, that.createdByUsername)
&& Objects.equals(lastUpdatedByUserId, that.lastUpdatedByUserId)
&& Objects.equals(lastUpdatedByUsername, that.lastUpdatedByUsername)
&& Objects.equals(repeatsOnDayOfMonth, that.repeatsOnDayOfMonth)
&& Objects.equals(entityTypeOptions, that.entityTypeOptions)
&& Objects.equals(calendarTypeOptions, that.calendarTypeOptions) && Objects.equals(remindByOptions, that.remindByOptions)
&& Objects.equals(frequencyOptions, that.frequencyOptions) && Objects.equals(repeatsOnDayOptions, that.repeatsOnDayOptions)
&& Objects.equals(frequencyNthDayTypeOptions, that.frequencyNthDayTypeOptions) && Objects.equals(rowIndex, that.rowIndex)
&& Objects.equals(dateFormat, that.dateFormat) && Objects.equals(locale, that.locale)
&& Objects.equals(centerId, that.centerId) && Objects.equals(typeId, that.typeId);
}
@Override
public int hashCode() {
return Objects.hash(id, calendarInstanceId, entityId, entityType, title, description, location, startDate, endDate, meetingTime,
duration, type, repeating, recurrence, frequency, interval, repeatsOnDay, repeatsOnNthDayOfMonth, remindBy, firstReminder,
secondReminder, recurringDates, nextTenRecurringDates, humanReadable, recentEligibleMeetingDate, createdDate,
lastUpdatedDate, createdByUserId, createdByUsername, lastUpdatedByUserId, lastUpdatedByUsername, repeatsOnDayOfMonth,
entityTypeOptions, calendarTypeOptions, remindByOptions, frequencyOptions, repeatsOnDayOptions, frequencyNthDayTypeOptions,
rowIndex, dateFormat, locale, centerId, typeId);
}
} }
@@ -25,6 +25,7 @@ import java.time.MonthDay;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import lombok.Getter;
import org.apache.fineract.accounting.glaccount.data.GLAccountData; import org.apache.fineract.accounting.glaccount.data.GLAccountData;
import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.organisation.monetary.data.CurrencyData; import org.apache.fineract.organisation.monetary.data.CurrencyData;
@@ -38,6 +39,7 @@ import org.apache.fineract.portfolio.tax.data.TaxGroupData;
/** /**
* Immutable data object for charge data. * Immutable data object for charge data.
*/ */
@Getter
public final class ChargeData implements Comparable<ChargeData>, Serializable { public final class ChargeData implements Comparable<ChargeData>, Serializable {
private final Long id; private final Long id;
@@ -354,10 +356,6 @@ public final class ChargeData implements Comparable<ChargeData>, Serializable {
amountPercentageAppliedTo, chargeOptions, isActive, chargeAmountOrPercentage); amountPercentageAppliedTo, chargeOptions, isActive, chargeAmountOrPercentage);
} }
public boolean isPenalty() {
return this.penalty;
}
public boolean isOverdueInstallmentCharge() { public boolean isOverdueInstallmentCharge() {
boolean isOverdueInstallmentCharge = false; boolean isOverdueInstallmentCharge = false;
if (this.chargeTimeType != null) { if (this.chargeTimeType != null) {
@@ -366,27 +364,7 @@ public final class ChargeData implements Comparable<ChargeData>, Serializable {
return isOverdueInstallmentCharge; return isOverdueInstallmentCharge;
} }
public Long getId() { public boolean isIsPaymentType() {
return id; return this.isPaymentType;
}
public String getName() {
return name;
}
public EnumOptionData getChargeCalculationType() {
return chargeCalculationType;
}
public EnumOptionData getChargeTimeType() {
return chargeTimeType;
}
public BigDecimal getAmount() {
return this.amount;
}
public CurrencyData getCurrency() {
return currency;
} }
} }
@@ -159,8 +159,8 @@ public class ClientIdentifiersApiResource {
// need to fetch client info // need to fetch client info
final ClientData clientInfo = this.clientReadPlatformService.retrieveClientByIdentifier(e.getDocumentTypeId(), final ClientData clientInfo = this.clientReadPlatformService.retrieveClientByIdentifier(e.getDocumentTypeId(),
e.getIdentifierKey()); e.getIdentifierKey());
rethrowas = new DuplicateClientIdentifierException(clientInfo.displayName(), clientInfo.officeName(), e.getIdentifierType(), rethrowas = new DuplicateClientIdentifierException(clientInfo.getDisplayName(), clientInfo.getOfficeName(),
e.getIdentifierKey()); e.getIdentifierType(), e.getIdentifierKey());
} }
throw rethrowas; throw rethrowas;
} }
@@ -216,8 +216,8 @@ public class ClientIdentifiersApiResource {
if (e.getDocumentTypeId() != null) { if (e.getDocumentTypeId() != null) {
final ClientData clientInfo = this.clientReadPlatformService.retrieveClientByIdentifier(e.getDocumentTypeId(), final ClientData clientInfo = this.clientReadPlatformService.retrieveClientByIdentifier(e.getDocumentTypeId(),
e.getIdentifierKey()); e.getIdentifierKey());
reThrowAs = new DuplicateClientIdentifierException(clientInfo.displayName(), clientInfo.officeName(), e.getIdentifierType(), reThrowAs = new DuplicateClientIdentifierException(clientInfo.getDisplayName(), clientInfo.getOfficeName(),
e.getIdentifierKey()); e.getIdentifierType(), e.getIdentifierKey());
} }
throw reThrowAs; throw reThrowAs;
} }
@@ -190,7 +190,7 @@ public class ClientsApiResource {
ClientData clientData = this.clientReadPlatformService.retrieveOne(clientId); ClientData clientData = this.clientReadPlatformService.retrieveOne(clientId);
if (settings.isTemplate()) { if (settings.isTemplate()) {
final ClientData templateData = this.clientReadPlatformService.retrieveTemplate(clientData.officeId(), final ClientData templateData = this.clientReadPlatformService.retrieveTemplate(clientData.getOfficeId(),
staffInSelectedOfficeOnly); staffInSelectedOfficeOnly);
clientData = ClientData.templateOnTop(clientData, templateData); clientData = ClientData.templateOnTop(clientData, templateData);
Collection<SavingsAccountData> savingAccountOptions = this.savingsAccountReadPlatformService.retrieveForLookup(clientId, null); Collection<SavingsAccountData> savingAccountOptions = this.savingsAccountReadPlatformService.retrieveForLookup(clientId, null);
@@ -20,22 +20,18 @@ package org.apache.fineract.portfolio.client.data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import lombok.Getter;
import org.apache.fineract.portfolio.collateralmanagement.domain.ClientCollateralManagement; import org.apache.fineract.portfolio.collateralmanagement.domain.ClientCollateralManagement;
@Getter
public final class ClientCollateralManagementData implements Serializable { public final class ClientCollateralManagementData implements Serializable {
private final BigDecimal quantity; private final BigDecimal quantity;
private final Long id; private final Long id;
private final BigDecimal pctToBase; private final BigDecimal pctToBase;
private final BigDecimal unitPrice; private final BigDecimal unitPrice;
private final BigDecimal total; private final BigDecimal total;
private final BigDecimal totalCollateral; private final BigDecimal totalCollateral;
private final String name; private final String name;
private ClientCollateralManagementData(final BigDecimal quantity, final Long id, final BigDecimal pctToBase, final BigDecimal unitPrice, private ClientCollateralManagementData(final BigDecimal quantity, final Long id, final BigDecimal pctToBase, final BigDecimal unitPrice,
@@ -55,28 +51,4 @@ public final class ClientCollateralManagementData implements Serializable {
clientCollateralManagements.getCollaterals().getPctToBase(), clientCollateralManagements.getCollaterals().getBasePrice(), clientCollateralManagements.getCollaterals().getPctToBase(), clientCollateralManagements.getCollaterals().getBasePrice(),
total, totalCollateral, clientCollateralManagements.getCollaterals().getName()); total, totalCollateral, clientCollateralManagements.getCollaterals().getName());
} }
public BigDecimal getQuantity() {
return this.quantity;
}
public BigDecimal getTotal() {
return this.total;
}
public BigDecimal getPctToBase() {
return this.pctToBase;
}
public BigDecimal getTotalCollateral() {
return this.totalCollateral;
}
public BigDecimal getUnitPrice() {
return this.unitPrice;
}
public Long getId() {
return this.id;
}
} }
@@ -23,6 +23,7 @@ import java.time.LocalDate;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.CompareToBuilder; import org.apache.commons.lang3.builder.CompareToBuilder;
import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.EqualsBuilder;
@@ -41,7 +42,7 @@ import org.apache.fineract.portfolio.savings.data.SavingsProductData;
/** /**
* Immutable data object representing client data. * Immutable data object representing client data.
*/ */
@SuppressWarnings("unused") @Getter
public final class ClientData implements Comparable<ClientData>, Serializable { public final class ClientData implements Comparable<ClientData>, Serializable {
private final Long id; private final Long id;
@@ -272,22 +273,6 @@ public final class ClientData implements Comparable<ClientData>, Serializable {
this.clientCollateralManagements = null; this.clientCollateralManagements = null;
} }
public Integer getRowIndex() {
return rowIndex;
}
public Long getSavingsAccountId() {
return savingsAccountId;
}
public Long getId() {
return id;
}
public String getOfficeName() {
return officeName;
}
public static ClientData template(final Long officeId, final LocalDate joinedDate, final Collection<OfficeData> officeOptions, public static ClientData template(final Long officeId, final LocalDate joinedDate, final Collection<OfficeData> officeOptions,
final Collection<StaffData> staffOptions, final Collection<CodeValueData> narrations, final Collection<StaffData> staffOptions, final Collection<CodeValueData> narrations,
final Collection<CodeValueData> genderOptions, final Collection<SavingsProductData> savingProductOptions, final Collection<CodeValueData> genderOptions, final Collection<SavingsProductData> savingProductOptions,
@@ -611,38 +596,6 @@ public final class ClientData implements Comparable<ClientData>, Serializable {
this.clientCollateralManagements = clientCollateralManagements; this.clientCollateralManagements = clientCollateralManagements;
} }
public Long id() {
return this.id;
}
public String displayName() {
return this.displayName;
}
public String accountNo() {
return this.accountNo;
}
public Long officeId() {
return this.officeId;
}
public String officeName() {
return this.officeName;
}
public Long getImageId() {
return this.imageId;
}
public Boolean getImagePresent() {
return this.imagePresent;
}
public ClientTimelineData getTimeline() {
return this.timeline;
}
@Override @Override
public int compareTo(final ClientData obj) { public int compareTo(final ClientData obj) {
if (obj == null) { if (obj == null) {
@@ -651,8 +604,6 @@ public final class ClientData implements Comparable<ClientData>, Serializable {
return new CompareToBuilder() // return new CompareToBuilder() //
.append(this.id, obj.id) // .append(this.id, obj.id) //
.append(this.displayName, obj.displayName) // .append(this.displayName, obj.displayName) //
.append(this.mobileNo, obj.mobileNo) //
.append(this.emailAddress, obj.emailAddress) //
.toComparison(); .toComparison();
} }
@@ -671,8 +622,6 @@ public final class ClientData implements Comparable<ClientData>, Serializable {
return new EqualsBuilder() // return new EqualsBuilder() //
.append(this.id, rhs.id) // .append(this.id, rhs.id) //
.append(this.displayName, rhs.displayName) // .append(this.displayName, rhs.displayName) //
.append(this.mobileNo, rhs.mobileNo) //
.append(this.emailAddress, rhs.emailAddress) //
.isEquals(); .isEquals();
} }
@@ -683,25 +632,4 @@ public final class ClientData implements Comparable<ClientData>, Serializable {
.append(this.displayName) // .append(this.displayName) //
.toHashCode(); .toHashCode();
} }
public String getExternalId() {
return this.externalId;
}
public String getFirstname() {
return this.firstname;
}
public String getLastname() {
return this.lastname;
}
public LocalDate getActivationDate() {
return this.activationDate;
}
public Boolean getIsAddressEnabled() {
return this.isAddressEnabled;
}
} }
@@ -20,11 +20,13 @@ package org.apache.fineract.portfolio.client.data;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDate; import java.time.LocalDate;
import lombok.Getter;
/** /**
* Immutable data object represent the important time-line events of a loan application and loan. * Immutable data object represent the important time-line events of a loan application and loan.
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Getter
public class ClientTimelineData implements Serializable { public class ClientTimelineData implements Serializable {
private final LocalDate submittedOnDate; private final LocalDate submittedOnDate;
@@ -20,7 +20,9 @@ package org.apache.fineract.portfolio.floatingrates.data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import lombok.Getter;
@Getter
public class InterestRatePeriodData { public class InterestRatePeriodData {
private LocalDate fromDate; private LocalDate fromDate;
@@ -41,50 +43,26 @@ public class InterestRatePeriodData {
this.blrInterestRate = blrInterestRate; this.blrInterestRate = blrInterestRate;
} }
public LocalDate getFromDate() {
return this.fromDate;
}
public void setFromDate(LocalDate fromDate) { public void setFromDate(LocalDate fromDate) {
this.fromDate = fromDate; this.fromDate = fromDate;
} }
public BigDecimal getInterestRate() {
return this.interestRate;
}
public boolean isDifferentialToBLR() { public boolean isDifferentialToBLR() {
return this.isDifferentialToBLR; return this.isDifferentialToBLR;
} }
public LocalDate getBlrFromDate() { public boolean isIsDifferentialToBLR() {
return this.blrFromDate; return this.isDifferentialToBLR;
}
public BigDecimal getBlrInterestRate() {
return this.blrInterestRate;
}
public BigDecimal getLoanDifferentialInterestRate() {
return this.loanDifferentialInterestRate;
} }
public void setLoanDifferentialInterestRate(BigDecimal loanDifferentialInterestRate) { public void setLoanDifferentialInterestRate(BigDecimal loanDifferentialInterestRate) {
this.loanDifferentialInterestRate = loanDifferentialInterestRate; this.loanDifferentialInterestRate = loanDifferentialInterestRate;
} }
public BigDecimal getLoanProductDifferentialInterestRate() {
return this.loanProductDifferentialInterestRate;
}
public void setLoanProductDifferentialInterestRate(BigDecimal loanProductDifferentialInterestRate) { public void setLoanProductDifferentialInterestRate(BigDecimal loanProductDifferentialInterestRate) {
this.loanProductDifferentialInterestRate = loanProductDifferentialInterestRate; this.loanProductDifferentialInterestRate = loanProductDifferentialInterestRate;
} }
public BigDecimal getEffectiveInterestRate() {
return this.effectiveInterestRate;
}
public void setEffectiveInterestRate(BigDecimal effectiveInterestRate) { public void setEffectiveInterestRate(BigDecimal effectiveInterestRate) {
this.effectiveInterestRate = effectiveInterestRate; this.effectiveInterestRate = effectiveInterestRate;
} }
@@ -23,6 +23,7 @@ import java.time.LocalDate;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import lombok.Getter;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.fineract.infrastructure.codes.data.CodeValueData; import org.apache.fineract.infrastructure.codes.data.CodeValueData;
import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.apache.fineract.infrastructure.core.data.EnumOptionData;
@@ -35,18 +36,16 @@ import org.apache.fineract.portfolio.client.data.ClientData;
/** /**
* Immutable data object representing a general group (so may or may not have a parent). * Immutable data object representing a general group (so may or may not have a parent).
*/ */
@Getter
public class GroupGeneralData implements Serializable { public class GroupGeneralData implements Serializable {
private final Long id; private final Long id;
private final String accountNo; private final String accountNo;
private final String name; private final String name;
private final String externalId; private final String externalId;
private final EnumOptionData status; private final EnumOptionData status;
@SuppressWarnings("unused")
private final Boolean active; private final Boolean active;
private final LocalDate activationDate; private final LocalDate activationDate;
private final Long officeId; private final Long officeId;
private final String officeName; private final String officeName;
private final Long centerId; private final Long centerId;
@@ -19,46 +19,22 @@
package org.apache.fineract.portfolio.group.data; package org.apache.fineract.portfolio.group.data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects; import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import org.apache.fineract.infrastructure.codes.data.CodeValueData; import org.apache.fineract.infrastructure.codes.data.CodeValueData;
@Getter
@EqualsAndHashCode
@AllArgsConstructor
public class GroupRoleData implements Serializable { public class GroupRoleData implements Serializable {
@SuppressWarnings("unused")
private final Long id; private final Long id;
@SuppressWarnings("unused")
private final CodeValueData role; private final CodeValueData role;
@SuppressWarnings("unused")
private final Long clientId; private final Long clientId;
@SuppressWarnings("unused")
private final String clientName; private final String clientName;
public static final GroupRoleData template() { public static final GroupRoleData template() {
return new GroupRoleData(null, null, null, null); return new GroupRoleData(null, null, null, null);
} }
public GroupRoleData(final Long id, final CodeValueData role, final Long clientId, final String clientName) {
this.id = id;
this.role = role;
this.clientId = clientId;
this.clientName = clientName;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof GroupRoleData)) {
return false;
}
GroupRoleData that = (GroupRoleData) o;
return Objects.equals(id, that.id) && Objects.equals(role, that.role) && Objects.equals(clientId, that.clientId)
&& Objects.equals(clientName, that.clientName);
}
@Override
public int hashCode() {
return Objects.hash(id, role, clientId, clientName);
}
} }
@@ -378,13 +378,13 @@ public class LoansApiResource {
: LoanAccountData.populateGroupDefaults(newLoanAccount, loanAccountGroupData); : LoanAccountData.populateGroupDefaults(newLoanAccount, loanAccountGroupData);
if (productId != null) { if (productId != null) {
Map<Long, Integer> memberLoanCycle = new HashMap<>(); Map<Long, Integer> memberLoanCycle = new HashMap<>();
Collection<ClientData> members = loanAccountGroupData.groupData().clientMembers(); Collection<ClientData> members = loanAccountGroupData.getGroup().clientMembers();
accountLinkingOptions = new ArrayList<>(); accountLinkingOptions = new ArrayList<>();
if (members != null) { if (members != null) {
for (ClientData clientData : members) { for (ClientData clientData : members) {
Integer loanCounter = this.loanReadPlatformService.retriveLoanCounter(clientData.id(), productId); Integer loanCounter = this.loanReadPlatformService.retriveLoanCounter(clientData.getId(), productId);
memberLoanCycle.put(clientData.id(), loanCounter); memberLoanCycle.put(clientData.getId(), loanCounter);
accountLinkingOptions.addAll(getaccountLinkingOptions(newLoanAccount, clientData.id(), groupId)); accountLinkingOptions.addAll(getaccountLinkingOptions(newLoanAccount, clientData.getId(), groupId));
} }
} }
@@ -417,10 +417,10 @@ public class LoansApiResource {
private Collection<PortfolioAccountData> getaccountLinkingOptions(final LoanAccountData newLoanAccount, final Long clientId, private Collection<PortfolioAccountData> getaccountLinkingOptions(final LoanAccountData newLoanAccount, final Long clientId,
final Long groupId) { final Long groupId) {
final CurrencyData currencyData = newLoanAccount.currency(); final CurrencyData currencyData = newLoanAccount.getCurrency();
String currencyCode = null; String currencyCode = null;
if (currencyData != null) { if (currencyData != null) {
currencyCode = currencyData.code(); currencyCode = currencyData.getCode();
} }
final long[] accountStatus = { SavingsAccountStatusType.ACTIVE.getValue() }; final long[] accountStatus = { SavingsAccountStatusType.ACTIVE.getValue() };
final PortfolioAccountDTO portfolioAccountDTO = new PortfolioAccountDTO(PortfolioAccountType.SAVINGS.getValue(), clientId, final PortfolioAccountDTO portfolioAccountDTO = new PortfolioAccountDTO(PortfolioAccountType.SAVINGS.getValue(), clientId,
@@ -630,7 +630,7 @@ public class LoansApiResource {
final boolean template = ApiParameterHelper.template(uriInfo.getQueryParameters()); final boolean template = ApiParameterHelper.template(uriInfo.getQueryParameters());
if (template) { if (template) {
productOptions = this.loanProductReadPlatformService.retrieveAllLoanProductsForLookup(); productOptions = this.loanProductReadPlatformService.retrieveAllLoanProductsForLookup();
product = this.loanProductReadPlatformService.retrieveLoanProduct(loanBasicDetails.loanProductId()); product = this.loanProductReadPlatformService.retrieveLoanProduct(loanBasicDetails.getLoanProductId());
loanBasicDetails.setProduct(product); loanBasicDetails.setProduct(product);
loanTermFrequencyTypeOptions = this.dropdownReadPlatformService.retrieveLoanTermFrequencyTypeOptions(); loanTermFrequencyTypeOptions = this.dropdownReadPlatformService.retrieveLoanTermFrequencyTypeOptions();
repaymentFrequencyTypeOptions = this.dropdownReadPlatformService.retrieveRepaymentFrequencyTypeOptions(); repaymentFrequencyTypeOptions = this.dropdownReadPlatformService.retrieveRepaymentFrequencyTypeOptions();
@@ -662,14 +662,14 @@ public class LoansApiResource {
loanPurposeOptions = this.codeValueReadPlatformService.retrieveCodeValuesByCode("LoanPurpose"); loanPurposeOptions = this.codeValueReadPlatformService.retrieveCodeValuesByCode("LoanPurpose");
loanCollateralOptions = this.codeValueReadPlatformService.retrieveCodeValuesByCode("LoanCollateral"); loanCollateralOptions = this.codeValueReadPlatformService.retrieveCodeValuesByCode("LoanCollateral");
final CurrencyData currencyData = loanBasicDetails.currency(); final CurrencyData currencyData = loanBasicDetails.getCurrency();
String currencyCode = null; String currencyCode = null;
if (currencyData != null) { if (currencyData != null) {
currencyCode = currencyData.code(); currencyCode = currencyData.getCode();
} }
final long[] accountStatus = { SavingsAccountStatusType.ACTIVE.getValue() }; final long[] accountStatus = { SavingsAccountStatusType.ACTIVE.getValue() };
PortfolioAccountDTO portfolioAccountDTO = new PortfolioAccountDTO(PortfolioAccountType.SAVINGS.getValue(), PortfolioAccountDTO portfolioAccountDTO = new PortfolioAccountDTO(PortfolioAccountType.SAVINGS.getValue(),
loanBasicDetails.clientId(), currencyCode, accountStatus, DepositAccountType.SAVINGS_DEPOSIT.getValue()); loanBasicDetails.getClientId(), currencyCode, accountStatus, DepositAccountType.SAVINGS_DEPOSIT.getValue());
accountLinkingOptions = this.portfolioAccountReadPlatformService.retrieveAllForLookup(portfolioAccountDTO); accountLinkingOptions = this.portfolioAccountReadPlatformService.retrieveAllForLookup(portfolioAccountDTO);
if (!associationParameters.contains(DataTableApiConstant.linkedAccountAssociateParamName)) { if (!associationParameters.contains(DataTableApiConstant.linkedAccountAssociateParamName)) {
@@ -680,15 +680,15 @@ public class LoansApiResource {
calendarOptions = this.loanReadPlatformService.retrieveCalendars(loanBasicDetails.groupId()); calendarOptions = this.loanReadPlatformService.retrieveCalendars(loanBasicDetails.groupId());
} }
if (loanBasicDetails.product().canUseForTopup() && loanBasicDetails.clientId() != null) { if (loanBasicDetails.getProduct().isCanUseForTopup() && loanBasicDetails.getClientId() != null) {
clientActiveLoanOptions = this.accountDetailsReadPlatformService clientActiveLoanOptions = this.accountDetailsReadPlatformService
.retrieveClientActiveLoanAccountSummary(loanBasicDetails.clientId()); .retrieveClientActiveLoanAccountSummary(loanBasicDetails.getClientId());
} }
} }
Collection<ChargeData> overdueCharges = this.chargeReadPlatformService.retrieveLoanProductCharges(loanBasicDetails.loanProductId(), Collection<ChargeData> overdueCharges = this.chargeReadPlatformService
ChargeTimeType.OVERDUE_INSTALLMENT); .retrieveLoanProductCharges(loanBasicDetails.getLoanProductId(), ChargeTimeType.OVERDUE_INSTALLMENT);
paidInAdvanceTemplate = this.loanReadPlatformService.retrieveTotalPaidInAdvance(loanId); paidInAdvanceTemplate = this.loanReadPlatformService.retrieveTotalPaidInAdvance(loanId);
@@ -20,19 +20,21 @@ package org.apache.fineract.portfolio.loanaccount.data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/** /**
* Immutable data object representing disbursement information. * Immutable data object representing disbursement information.
*/ */
public class DisbursementData implements Comparable<DisbursementData> { @RequiredArgsConstructor
@Getter
public final class DisbursementData implements Comparable<DisbursementData> {
@SuppressWarnings("unused")
private final Long id; private final Long id;
private final LocalDate expectedDisbursementDate; private final LocalDate expectedDisbursementDate;
private final LocalDate actualDisbursementDate; private final LocalDate actualDisbursementDate;
private final BigDecimal principal; private final BigDecimal principal;
private final BigDecimal netDisbursalAmount; private final BigDecimal netDisbursalAmount;
@SuppressWarnings("unused")
private final String loanChargeId; private final String loanChargeId;
private final BigDecimal chargeAmount; private final BigDecimal chargeAmount;
private final BigDecimal waivedChargeAmount; private final BigDecimal waivedChargeAmount;
@@ -66,23 +68,6 @@ public class DisbursementData implements Comparable<DisbursementData> {
} }
public String getLinkAccountId() {
return linkAccountId;
}
public DisbursementData(Long id, final LocalDate expectedDisbursementDate, final LocalDate actualDisbursementDate,
final BigDecimal principalDisbursed, final BigDecimal netDisbursalAmount, final String loanChargeId, BigDecimal chargeAmount,
BigDecimal waivedChargeAmount) {
this.id = id;
this.expectedDisbursementDate = expectedDisbursementDate;
this.actualDisbursementDate = actualDisbursementDate;
this.principal = principalDisbursed;
this.loanChargeId = loanChargeId;
this.chargeAmount = chargeAmount;
this.waivedChargeAmount = waivedChargeAmount;
this.netDisbursalAmount = netDisbursalAmount;
}
public LocalDate disbursementDate() { public LocalDate disbursementDate() {
LocalDate disbursementDate = this.expectedDisbursementDate; LocalDate disbursementDate = this.expectedDisbursementDate;
if (this.actualDisbursementDate != null) { if (this.actualDisbursementDate != null) {
@@ -91,14 +76,6 @@ public class DisbursementData implements Comparable<DisbursementData> {
return disbursementDate; return disbursementDate;
} }
public BigDecimal amount() {
return this.principal;
}
public BigDecimal getChargeAmount() {
return this.chargeAmount;
}
public boolean isDisbursed() { public boolean isDisbursed() {
return this.actualDisbursementDate != null; return this.actualDisbursementDate != null;
} }
@@ -28,6 +28,7 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import javax.persistence.Transient; import javax.persistence.Transient;
import lombok.Getter;
import org.apache.fineract.infrastructure.codes.data.CodeValueData; import org.apache.fineract.infrastructure.codes.data.CodeValueData;
import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.infrastructure.dataqueries.data.DatatableData; import org.apache.fineract.infrastructure.dataqueries.data.DatatableData;
@@ -57,7 +58,7 @@ import org.springframework.util.CollectionUtils;
/** /**
* Immutable data object representing loan account data. * Immutable data object representing loan account data.
*/ */
@SuppressWarnings("unused") @Getter
public final class LoanAccountData { public final class LoanAccountData {
// basic loan details // basic loan details
@@ -113,7 +114,7 @@ public final class LoanAccountData {
private final EnumOptionData amortizationType; private final EnumOptionData amortizationType;
private final EnumOptionData interestType; private final EnumOptionData interestType;
private final EnumOptionData interestCalculationPeriodType; private final EnumOptionData interestCalculationPeriodType;
private final Boolean allowPartialPeriodInterestCalcualtion; private final Boolean allowPartialPeriodInterestCalculation;
private final BigDecimal inArrearsTolerance; private final BigDecimal inArrearsTolerance;
private final Long transactionProcessingStrategyId; private final Long transactionProcessingStrategyId;
private final String transactionProcessingStrategyName; private final String transactionProcessingStrategyName;
@@ -355,7 +356,7 @@ public final class LoanAccountData {
this.isFloatingInterestRate = false; this.isFloatingInterestRate = false;
this.interestRateDifferential = null; this.interestRateDifferential = null;
this.allowPartialPeriodInterestCalcualtion = null; this.allowPartialPeriodInterestCalculation = null;
this.transactionProcessingStrategyName = null; this.transactionProcessingStrategyName = null;
@@ -431,34 +432,6 @@ public final class LoanAccountData {
this.delinquencyRange = null; this.delinquencyRange = null;
} }
public Integer getRowIndex() {
return rowIndex;
}
public Long getClientId() {
return clientId;
}
public String getClientName() {
return clientName;
}
public BigDecimal getPrincipal() {
return principal;
}
public LoanApplicationTimelineData getTimeline() {
return timeline;
}
public String getAccountNo() {
return accountNo;
}
public String getLoanProductName() {
return loanProductName;
}
public static final Comparator<LoanAccountData> ClientNameComparator = new Comparator<LoanAccountData>() { public static final Comparator<LoanAccountData> ClientNameComparator = new Comparator<LoanAccountData>() {
@Override @Override
@@ -469,10 +442,6 @@ public final class LoanAccountData {
} }
}; };
public String getClientAccountNo() {
return clientAccountNo;
}
/** /**
* Used to produce a {@link LoanAccountData} with only collateral options for now. * Used to produce a {@link LoanAccountData} with only collateral options for now.
*/ */
@@ -778,7 +747,7 @@ public final class LoanAccountData {
acc.repaymentFrequencyNthDayType, acc.repaymentFrequencyDayOfWeekType, acc.transactionProcessingStrategyId, acc.repaymentFrequencyNthDayType, acc.repaymentFrequencyDayOfWeekType, acc.transactionProcessingStrategyId,
acc.transactionProcessingStrategyName, acc.amortizationType, acc.interestRatePerPeriod, acc.interestRateFrequencyType, acc.transactionProcessingStrategyName, acc.amortizationType, acc.interestRatePerPeriod, acc.interestRateFrequencyType,
acc.annualInterestRate, acc.interestType, acc.isFloatingInterestRate, acc.interestRateDifferential, acc.annualInterestRate, acc.interestType, acc.isFloatingInterestRate, acc.interestRateDifferential,
acc.interestCalculationPeriodType, acc.allowPartialPeriodInterestCalcualtion, acc.expectedFirstRepaymentOnDate, acc.interestCalculationPeriodType, acc.allowPartialPeriodInterestCalculation, acc.expectedFirstRepaymentOnDate,
acc.graceOnPrincipalPayment, acc.recurringMoratoriumOnPrincipalPeriods, acc.graceOnInterestPayment, acc.graceOnPrincipalPayment, acc.recurringMoratoriumOnPrincipalPeriods, acc.graceOnInterestPayment,
acc.graceOnInterestCharged, acc.interestChargedFromDate, clientAcc.timeline, acc.summary, acc.graceOnInterestCharged, acc.interestChargedFromDate, clientAcc.timeline, acc.summary,
acc.feeChargesAtDisbursementCharged, acc.repaymentSchedule, acc.transactions, acc.charges, acc.collateral, acc.guarantors, acc.feeChargesAtDisbursementCharged, acc.repaymentSchedule, acc.transactions, acc.charges, acc.collateral, acc.guarantors,
@@ -957,7 +926,7 @@ public final class LoanAccountData {
acc.repaymentEvery, acc.repaymentFrequencyType, acc.repaymentFrequencyNthDayType, acc.repaymentFrequencyDayOfWeekType, acc.repaymentEvery, acc.repaymentFrequencyType, acc.repaymentFrequencyNthDayType, acc.repaymentFrequencyDayOfWeekType,
acc.transactionProcessingStrategyId, acc.transactionProcessingStrategyName, acc.amortizationType, acc.interestRatePerPeriod, acc.transactionProcessingStrategyId, acc.transactionProcessingStrategyName, acc.amortizationType, acc.interestRatePerPeriod,
acc.interestRateFrequencyType, acc.annualInterestRate, acc.interestType, acc.isFloatingInterestRate, acc.interestRateFrequencyType, acc.annualInterestRate, acc.interestType, acc.isFloatingInterestRate,
acc.interestRateDifferential, acc.interestCalculationPeriodType, acc.allowPartialPeriodInterestCalcualtion, acc.interestRateDifferential, acc.interestCalculationPeriodType, acc.allowPartialPeriodInterestCalculation,
acc.expectedFirstRepaymentOnDate, acc.graceOnPrincipalPayment, acc.recurringMoratoriumOnPrincipalPeriods, acc.expectedFirstRepaymentOnDate, acc.graceOnPrincipalPayment, acc.recurringMoratoriumOnPrincipalPeriods,
acc.graceOnInterestPayment, acc.graceOnInterestCharged, acc.interestChargedFromDate, groupAcc.timeline, acc.summary, acc.graceOnInterestPayment, acc.graceOnInterestCharged, acc.interestChargedFromDate, groupAcc.timeline, acc.summary,
acc.feeChargesAtDisbursementCharged, acc.repaymentSchedule, acc.transactions, acc.charges, acc.collateral, acc.guarantors, acc.feeChargesAtDisbursementCharged, acc.repaymentSchedule, acc.transactions, acc.charges, acc.collateral, acc.guarantors,
@@ -1060,7 +1029,7 @@ public final class LoanAccountData {
BigDecimal interestRatePerPeriod = null; BigDecimal interestRatePerPeriod = null;
Integer numberOfRepayments = null; Integer numberOfRepayments = null;
if (product.useBorrowerCycle() && loanCycleNumber > 0) { if (product.isUseBorrowerCycle() && loanCycleNumber > 0) {
Collection<LoanProductBorrowerCycleVariationData> principalVariationsForBorrowerCycle = product Collection<LoanProductBorrowerCycleVariationData> principalVariationsForBorrowerCycle = product
.getPrincipalVariationsForBorrowerCycle(); .getPrincipalVariationsForBorrowerCycle();
Collection<LoanProductBorrowerCycleVariationData> interestForVariationsForBorrowerCycle = product Collection<LoanProductBorrowerCycleVariationData> interestForVariationsForBorrowerCycle = product
@@ -1108,7 +1077,7 @@ public final class LoanAccountData {
final Boolean isVariableInstallmentsAllowed = Boolean.FALSE; final Boolean isVariableInstallmentsAllowed = Boolean.FALSE;
final Integer minimumGap = null; final Integer minimumGap = null;
final Integer maximumGap = null; final Integer maximumGap = null;
final Boolean canUseForTopup = product.canUseForTopup(); final Boolean canUseForTopup = product.isCanUseForTopup();
final boolean isTopup = false; final boolean isTopup = false;
final Long closureLoanId = null; final Long closureLoanId = null;
final String closureLoanAccountNo = null; final String closureLoanAccountNo = null;
@@ -1127,8 +1096,8 @@ public final class LoanAccountData {
transactionProcessingStrategyName, product.getAmortizationType(), interestRatePerPeriod, transactionProcessingStrategyName, product.getAmortizationType(), interestRatePerPeriod,
product.getInterestRateFrequencyType(), product.getAnnualInterestRate(), product.getInterestType(), product.getInterestRateFrequencyType(), product.getAnnualInterestRate(), product.getInterestType(),
product.isFloatingInterestRateCalculationAllowed(), product.getDefaultDifferentialLendingRate(), product.isFloatingInterestRateCalculationAllowed(), product.getDefaultDifferentialLendingRate(),
product.getInterestCalculationPeriodType(), product.getAllowPartialPeriodInterestCalcualtion(), product.getInterestCalculationPeriodType(), product.isAllowPartialPeriodInterestCalculation(), expectedFirstRepaymentOnDate,
expectedFirstRepaymentOnDate, product.getGraceOnPrincipalPayment(), product.getRecurringMoratoriumOnPrincipalPeriods(), product.getGraceOnPrincipalPayment(), product.getRecurringMoratoriumOnPrincipalPeriods(),
product.getGraceOnInterestPayment(), product.getGraceOnInterestCharged(), interestChargedFromDate, timeline, summary, product.getGraceOnInterestPayment(), product.getGraceOnInterestCharged(), interestChargedFromDate, timeline, summary,
feeChargesDueAtDisbursementCharged, repaymentSchedule, transactions, charges, collateral, guarantors, calendarData, feeChargesDueAtDisbursementCharged, repaymentSchedule, transactions, charges, collateral, guarantors, calendarData,
productOptions, termFrequencyTypeOptions, repaymentFrequencyTypeOptions, repaymentFrequencyNthDayTypeOptions, productOptions, termFrequencyTypeOptions, repaymentFrequencyTypeOptions, repaymentFrequencyNthDayTypeOptions,
@@ -1136,14 +1105,14 @@ public final class LoanAccountData {
interestTypeOptions, interestCalculationPeriodTypeOptions, fundOptions, chargeOptions, chargeTemplate, loanOfficerOptions, interestTypeOptions, interestCalculationPeriodTypeOptions, fundOptions, chargeOptions, chargeTemplate, loanOfficerOptions,
loanPurposeOptions, loanCollateralOptions, calendarOptions, syncDisbursementWithMeeting, loancounter, loanProductCounter, loanPurposeOptions, loanCollateralOptions, calendarOptions, syncDisbursementWithMeeting, loancounter, loanProductCounter,
notes, accountLinkingOptions, linkedAccount, disbursementData, product.getMultiDisburseLoan(), notes, accountLinkingOptions, linkedAccount, disbursementData, product.getMultiDisburseLoan(),
product.canDefineInstallmentAmount(), fixedEmi, product.getOutstandingLoanBalance(), emiAmountVariations, memberVariations, product.isCanDefineInstallmentAmount(), fixedEmi, product.getOutstandingLoanBalance(), emiAmountVariations,
product, inArrears, product.getGraceOnArrearsAgeing(), product.overdueFeeCharges(), isNPA, product.getDaysInMonthType(), memberVariations, product, inArrears, product.getGraceOnArrearsAgeing(), product.overdueFeeCharges(), isNPA,
product.getDaysInYearType(), product.isInterestRecalculationEnabled(), product.toLoanInterestRecalculationData(), product.getDaysInMonthType(), product.getDaysInYearType(), product.isInterestRecalculationEnabled(),
originalSchedule, createStandingInstructionAtDisbursement, paidInAdvance, interestRatesPeriods, product.toLoanInterestRecalculationData(), originalSchedule, createStandingInstructionAtDisbursement, paidInAdvance,
product.isVariableInstallmentsAllowed(), product.getMinimumGapBetweenInstallments(), interestRatesPeriods, product.isAllowVariableInstallments(), product.getMinimumGap(), product.getMaximumGap(), subStatus,
product.getMaximumGapBetweenInstallments(), subStatus, canUseForTopup, clientActiveLoanOptions, isTopup, closureLoanId, canUseForTopup, clientActiveLoanOptions, isTopup, closureLoanId, closureLoanAccountNo, topupAmount,
closureLoanAccountNo, topupAmount, product.isEqualAmortization(), rates, isRatesEnabled, product.isEqualAmortization(), rates, isRatesEnabled, product.getFixedPrincipalPercentagePerInstallment(), delinquent,
product.getFixedPrincipalPercentagePerInstallment(), delinquent, delinquencyRange); delinquencyRange);
} }
public static LoanAccountData populateLoanProductDefaults(final LoanAccountData acc, final LoanProductData product) { public static LoanAccountData populateLoanProductDefaults(final LoanAccountData acc, final LoanProductData product) {
@@ -1198,7 +1167,7 @@ public final class LoanAccountData {
product.getTransactionProcessingStrategyName(), product.getAmortizationType(), product.getInterestRatePerPeriod(), product.getTransactionProcessingStrategyName(), product.getAmortizationType(), product.getInterestRatePerPeriod(),
product.getInterestRateFrequencyType(), product.getAnnualInterestRate(), product.getInterestType(), product.getInterestRateFrequencyType(), product.getAnnualInterestRate(), product.getInterestType(),
product.isFloatingInterestRateCalculationAllowed(), product.getDefaultDifferentialLendingRate(), product.isFloatingInterestRateCalculationAllowed(), product.getDefaultDifferentialLendingRate(),
product.getInterestCalculationPeriodType(), product.getAllowPartialPeriodInterestCalcualtion(), product.getInterestCalculationPeriodType(), product.isAllowPartialPeriodInterestCalculation(),
acc.expectedFirstRepaymentOnDate, product.getGraceOnPrincipalPayment(), product.getRecurringMoratoriumOnPrincipalPeriods(), acc.expectedFirstRepaymentOnDate, product.getGraceOnPrincipalPayment(), product.getRecurringMoratoriumOnPrincipalPeriods(),
product.getGraceOnInterestPayment(), product.getGraceOnInterestCharged(), acc.interestChargedFromDate, acc.timeline, product.getGraceOnInterestPayment(), product.getGraceOnInterestCharged(), acc.interestChargedFromDate, acc.timeline,
acc.summary, acc.feeChargesAtDisbursementCharged, repaymentSchedule, transactions, charges, collateral, guarantors, acc.summary, acc.feeChargesAtDisbursementCharged, repaymentSchedule, transactions, charges, collateral, guarantors,
@@ -1206,15 +1175,15 @@ public final class LoanAccountData {
interestRateFrequencyTypeOptions, amortizationTypeOptions, interestTypeOptions, interestCalculationPeriodTypeOptions, interestRateFrequencyTypeOptions, amortizationTypeOptions, interestTypeOptions, interestCalculationPeriodTypeOptions,
fundOptions, chargeOptions, chargeTemplate, loanOfficerOptions, loanPurposeOptions, loanCollateralOptions, calendarOptions, fundOptions, chargeOptions, chargeTemplate, loanOfficerOptions, loanPurposeOptions, loanCollateralOptions, calendarOptions,
acc.syncDisbursementWithMeeting, acc.loanCounter, acc.loanProductCounter, notes, acc.accountLinkingOptions, acc.syncDisbursementWithMeeting, acc.loanCounter, acc.loanProductCounter, notes, acc.accountLinkingOptions,
acc.linkedAccount, acc.disbursementDetails, product.getMultiDisburseLoan(), product.canDefineInstallmentAmount(), acc.linkedAccount, acc.disbursementDetails, product.getMultiDisburseLoan(), product.isCanDefineInstallmentAmount(),
acc.fixedEmiAmount, product.getOutstandingLoanBalance(), acc.emiAmountVariations, acc.memberVariations, product, acc.fixedEmiAmount, product.getOutstandingLoanBalance(), acc.emiAmountVariations, acc.memberVariations, product,
acc.inArrears, product.getGraceOnArrearsAgeing(), product.overdueFeeCharges(), acc.isNPA, product.getDaysInMonthType(), acc.inArrears, product.getGraceOnArrearsAgeing(), product.overdueFeeCharges(), acc.isNPA, product.getDaysInMonthType(),
product.getDaysInYearType(), product.isInterestRecalculationEnabled(), product.toLoanInterestRecalculationData(), product.getDaysInYearType(), product.isInterestRecalculationEnabled(), product.toLoanInterestRecalculationData(),
acc.originalSchedule, acc.createStandingInstructionAtDisbursement, paidInAdvance, acc.interestRatesPeriods, acc.originalSchedule, acc.createStandingInstructionAtDisbursement, paidInAdvance, acc.interestRatesPeriods,
product.isVariableInstallmentsAllowed(), product.getMinimumGapBetweenInstallments(), product.isAllowVariableInstallments(), product.getMinimumGap(), product.getMaximumGap(), acc.subStatus, acc.canUseForTopup,
product.getMaximumGapBetweenInstallments(), acc.subStatus, acc.canUseForTopup, acc.clientActiveLoanOptions, acc.isTopup, acc.clientActiveLoanOptions, acc.isTopup, acc.closureLoanId, acc.closureLoanAccountNo, acc.topupAmount,
acc.closureLoanId, acc.closureLoanAccountNo, acc.topupAmount, product.isEqualAmortization(), acc.rates, acc.isRatesEnabled, product.isEqualAmortization(), acc.rates, acc.isRatesEnabled, product.getFixedPrincipalPercentagePerInstallment(),
product.getFixedPrincipalPercentagePerInstallment(), delinquent, delinquencyRange); delinquent, delinquencyRange);
} }
/* /*
@@ -1333,7 +1302,7 @@ public final class LoanAccountData {
final CollectionData delinquent) { final CollectionData delinquent) {
LoanProductConfigurableAttributes loanProductConfigurableAttributes = null; LoanProductConfigurableAttributes loanProductConfigurableAttributes = null;
if (acc.product != null) { if (acc.product != null) {
loanProductConfigurableAttributes = acc.product.getLoanProductConfigurableAttributes(); loanProductConfigurableAttributes = acc.product.getAllowAttributeOverrides();
} }
return new LoanAccountData(acc.id, acc.accountNo, acc.status, acc.externalId, acc.clientId, acc.clientAccountNo, acc.clientName, return new LoanAccountData(acc.id, acc.accountNo, acc.status, acc.externalId, acc.clientId, acc.clientAccountNo, acc.clientName,
@@ -1344,7 +1313,7 @@ public final class LoanAccountData {
acc.repaymentEvery, acc.repaymentFrequencyType, acc.repaymentFrequencyNthDayType, acc.repaymentFrequencyDayOfWeekType, acc.repaymentEvery, acc.repaymentFrequencyType, acc.repaymentFrequencyNthDayType, acc.repaymentFrequencyDayOfWeekType,
acc.transactionProcessingStrategyId, acc.transactionProcessingStrategyName, acc.amortizationType, acc.interestRatePerPeriod, acc.transactionProcessingStrategyId, acc.transactionProcessingStrategyName, acc.amortizationType, acc.interestRatePerPeriod,
acc.interestRateFrequencyType, acc.annualInterestRate, acc.interestType, acc.isFloatingInterestRate, acc.interestRateFrequencyType, acc.annualInterestRate, acc.interestType, acc.isFloatingInterestRate,
acc.interestRateDifferential, acc.interestCalculationPeriodType, acc.allowPartialPeriodInterestCalcualtion, acc.interestRateDifferential, acc.interestCalculationPeriodType, acc.allowPartialPeriodInterestCalculation,
acc.expectedFirstRepaymentOnDate, acc.graceOnPrincipalPayment, acc.recurringMoratoriumOnPrincipalPeriods, acc.expectedFirstRepaymentOnDate, acc.graceOnPrincipalPayment, acc.recurringMoratoriumOnPrincipalPeriods,
acc.graceOnInterestPayment, acc.graceOnInterestCharged, acc.interestChargedFromDate, acc.timeline, acc.summary, acc.graceOnInterestPayment, acc.graceOnInterestCharged, acc.interestChargedFromDate, acc.timeline, acc.summary,
acc.feeChargesAtDisbursementCharged, repaymentSchedule, transactions, charges, collateral, guarantors, calendarData, acc.feeChargesAtDisbursementCharged, repaymentSchedule, transactions, charges, collateral, guarantors, calendarData,
@@ -1386,7 +1355,7 @@ public final class LoanAccountData {
acc.repaymentEvery, acc.repaymentFrequencyType, acc.repaymentFrequencyNthDayType, acc.repaymentFrequencyDayOfWeekType, acc.repaymentEvery, acc.repaymentFrequencyType, acc.repaymentFrequencyNthDayType, acc.repaymentFrequencyDayOfWeekType,
acc.transactionProcessingStrategyId, acc.transactionProcessingStrategyName, acc.amortizationType, acc.interestRatePerPeriod, acc.transactionProcessingStrategyId, acc.transactionProcessingStrategyName, acc.amortizationType, acc.interestRatePerPeriod,
acc.interestRateFrequencyType, acc.annualInterestRate, acc.interestType, acc.isFloatingInterestRate, acc.interestRateFrequencyType, acc.annualInterestRate, acc.interestType, acc.isFloatingInterestRate,
acc.interestRateDifferential, acc.interestCalculationPeriodType, acc.allowPartialPeriodInterestCalcualtion, acc.interestRateDifferential, acc.interestCalculationPeriodType, acc.allowPartialPeriodInterestCalculation,
acc.expectedFirstRepaymentOnDate, acc.graceOnPrincipalPayment, acc.recurringMoratoriumOnPrincipalPeriods, acc.expectedFirstRepaymentOnDate, acc.graceOnPrincipalPayment, acc.recurringMoratoriumOnPrincipalPeriods,
acc.graceOnInterestPayment, acc.graceOnInterestCharged, acc.interestChargedFromDate, acc.timeline, acc.summary, acc.graceOnInterestPayment, acc.graceOnInterestCharged, acc.interestChargedFromDate, acc.timeline, acc.summary,
acc.feeChargesAtDisbursementCharged, acc.repaymentSchedule, acc.transactions, acc.charges, acc.collateral, acc.guarantors, acc.feeChargesAtDisbursementCharged, acc.repaymentSchedule, acc.transactions, acc.charges, acc.collateral, acc.guarantors,
@@ -1415,7 +1384,7 @@ public final class LoanAccountData {
Integer numberOfRepayments = null; Integer numberOfRepayments = null;
Long clientId = mapEntry.getKey(); Long clientId = mapEntry.getKey();
Integer loanCycleNumber = mapEntry.getValue(); Integer loanCycleNumber = mapEntry.getValue();
if (acc.product.useBorrowerCycle() && loanCycleNumber != null && loanCycleNumber > 0) { if (acc.product.isUseBorrowerCycle() && loanCycleNumber != null && loanCycleNumber > 0) {
Collection<LoanProductBorrowerCycleVariationData> principalVariationsForBorrowerCycle = acc.product Collection<LoanProductBorrowerCycleVariationData> principalVariationsForBorrowerCycle = acc.product
.getPrincipalVariationsForBorrowerCycle(); .getPrincipalVariationsForBorrowerCycle();
Collection<LoanProductBorrowerCycleVariationData> interestForVariationsForBorrowerCycle = acc.product Collection<LoanProductBorrowerCycleVariationData> interestForVariationsForBorrowerCycle = acc.product
@@ -1452,7 +1421,7 @@ public final class LoanAccountData {
acc.repaymentEvery, acc.repaymentFrequencyType, acc.repaymentFrequencyNthDayType, acc.repaymentFrequencyDayOfWeekType, acc.repaymentEvery, acc.repaymentFrequencyType, acc.repaymentFrequencyNthDayType, acc.repaymentFrequencyDayOfWeekType,
acc.transactionProcessingStrategyId, acc.transactionProcessingStrategyName, acc.amortizationType, acc.interestRatePerPeriod, acc.transactionProcessingStrategyId, acc.transactionProcessingStrategyName, acc.amortizationType, acc.interestRatePerPeriod,
acc.interestRateFrequencyType, acc.annualInterestRate, acc.interestType, acc.isFloatingInterestRate, acc.interestRateFrequencyType, acc.annualInterestRate, acc.interestType, acc.isFloatingInterestRate,
acc.interestRateDifferential, acc.interestCalculationPeriodType, acc.allowPartialPeriodInterestCalcualtion, acc.interestRateDifferential, acc.interestCalculationPeriodType, acc.allowPartialPeriodInterestCalculation,
acc.expectedFirstRepaymentOnDate, acc.graceOnPrincipalPayment, acc.recurringMoratoriumOnPrincipalPeriods, acc.expectedFirstRepaymentOnDate, acc.graceOnPrincipalPayment, acc.recurringMoratoriumOnPrincipalPeriods,
acc.graceOnInterestPayment, acc.graceOnInterestCharged, acc.interestChargedFromDate, acc.timeline, acc.summary, acc.graceOnInterestPayment, acc.graceOnInterestCharged, acc.interestChargedFromDate, acc.timeline, acc.summary,
acc.feeChargesAtDisbursementCharged, acc.repaymentSchedule, acc.transactions, acc.charges, acc.collateral, acc.guarantors, acc.feeChargesAtDisbursementCharged, acc.repaymentSchedule, acc.transactions, acc.charges, acc.collateral, acc.guarantors,
@@ -1486,7 +1455,7 @@ public final class LoanAccountData {
acc.repaymentEvery, acc.repaymentFrequencyType, acc.repaymentFrequencyNthDayType, acc.repaymentFrequencyDayOfWeekType, acc.repaymentEvery, acc.repaymentFrequencyType, acc.repaymentFrequencyNthDayType, acc.repaymentFrequencyDayOfWeekType,
acc.transactionProcessingStrategyId, acc.transactionProcessingStrategyName, acc.amortizationType, acc.interestRatePerPeriod, acc.transactionProcessingStrategyId, acc.transactionProcessingStrategyName, acc.amortizationType, acc.interestRatePerPeriod,
acc.interestRateFrequencyType, acc.annualInterestRate, acc.interestType, acc.isFloatingInterestRate, acc.interestRateFrequencyType, acc.annualInterestRate, acc.interestType, acc.isFloatingInterestRate,
acc.interestRateDifferential, acc.interestCalculationPeriodType, acc.allowPartialPeriodInterestCalcualtion, acc.interestRateDifferential, acc.interestCalculationPeriodType, acc.allowPartialPeriodInterestCalculation,
acc.expectedFirstRepaymentOnDate, acc.graceOnPrincipalPayment, acc.recurringMoratoriumOnPrincipalPeriods, acc.expectedFirstRepaymentOnDate, acc.graceOnPrincipalPayment, acc.recurringMoratoriumOnPrincipalPeriods,
acc.graceOnInterestPayment, acc.graceOnInterestCharged, acc.interestChargedFromDate, acc.timeline, acc.summary, acc.graceOnInterestPayment, acc.graceOnInterestCharged, acc.interestChargedFromDate, acc.timeline, acc.summary,
acc.feeChargesAtDisbursementCharged, acc.repaymentSchedule, acc.transactions, acc.charges, acc.collateral, acc.guarantors, acc.feeChargesAtDisbursementCharged, acc.repaymentSchedule, acc.transactions, acc.charges, acc.collateral, acc.guarantors,
@@ -1515,7 +1484,7 @@ public final class LoanAccountData {
acc.repaymentEvery, acc.repaymentFrequencyType, calendarData.getRepeatsOnNthDayOfMonth(), calendarData.getRepeatsOnDay(), acc.repaymentEvery, acc.repaymentFrequencyType, calendarData.getRepeatsOnNthDayOfMonth(), calendarData.getRepeatsOnDay(),
acc.transactionProcessingStrategyId, acc.transactionProcessingStrategyName, acc.amortizationType, acc.interestRatePerPeriod, acc.transactionProcessingStrategyId, acc.transactionProcessingStrategyName, acc.amortizationType, acc.interestRatePerPeriod,
acc.interestRateFrequencyType, acc.annualInterestRate, acc.interestType, acc.isFloatingInterestRate, acc.interestRateFrequencyType, acc.annualInterestRate, acc.interestType, acc.isFloatingInterestRate,
acc.interestRateDifferential, acc.interestCalculationPeriodType, acc.allowPartialPeriodInterestCalcualtion, acc.interestRateDifferential, acc.interestCalculationPeriodType, acc.allowPartialPeriodInterestCalculation,
acc.expectedFirstRepaymentOnDate, acc.graceOnPrincipalPayment, acc.recurringMoratoriumOnPrincipalPeriods, acc.expectedFirstRepaymentOnDate, acc.graceOnPrincipalPayment, acc.recurringMoratoriumOnPrincipalPeriods,
acc.graceOnInterestPayment, acc.graceOnInterestCharged, acc.interestChargedFromDate, acc.timeline, acc.summary, acc.graceOnInterestPayment, acc.graceOnInterestCharged, acc.interestChargedFromDate, acc.timeline, acc.summary,
acc.feeChargesAtDisbursementCharged, acc.repaymentSchedule, acc.transactions, acc.charges, acc.collateral, acc.guarantors, acc.feeChargesAtDisbursementCharged, acc.repaymentSchedule, acc.transactions, acc.charges, acc.collateral, acc.guarantors,
@@ -1545,7 +1514,7 @@ public final class LoanAccountData {
acc.repaymentEvery, acc.repaymentFrequencyType, acc.repaymentFrequencyNthDayType, acc.repaymentFrequencyDayOfWeekType, acc.repaymentEvery, acc.repaymentFrequencyType, acc.repaymentFrequencyNthDayType, acc.repaymentFrequencyDayOfWeekType,
acc.transactionProcessingStrategyId, acc.transactionProcessingStrategyName, acc.amortizationType, acc.interestRatePerPeriod, acc.transactionProcessingStrategyId, acc.transactionProcessingStrategyName, acc.amortizationType, acc.interestRatePerPeriod,
acc.interestRateFrequencyType, acc.annualInterestRate, acc.interestType, acc.isFloatingInterestRate, acc.interestRateFrequencyType, acc.annualInterestRate, acc.interestType, acc.isFloatingInterestRate,
acc.interestRateDifferential, acc.interestCalculationPeriodType, acc.allowPartialPeriodInterestCalcualtion, acc.interestRateDifferential, acc.interestCalculationPeriodType, acc.allowPartialPeriodInterestCalculation,
acc.expectedFirstRepaymentOnDate, acc.graceOnPrincipalPayment, acc.recurringMoratoriumOnPrincipalPeriods, acc.expectedFirstRepaymentOnDate, acc.graceOnPrincipalPayment, acc.recurringMoratoriumOnPrincipalPeriods,
acc.graceOnInterestPayment, acc.graceOnInterestCharged, acc.interestChargedFromDate, acc.timeline, acc.summary, acc.graceOnInterestPayment, acc.graceOnInterestCharged, acc.interestChargedFromDate, acc.timeline, acc.summary,
acc.feeChargesAtDisbursementCharged, acc.repaymentSchedule, acc.transactions, acc.charges, acc.collateral, acc.guarantors, acc.feeChargesAtDisbursementCharged, acc.repaymentSchedule, acc.transactions, acc.charges, acc.collateral, acc.guarantors,
@@ -1585,7 +1554,7 @@ public final class LoanAccountData {
final EnumOptionData amortizationType, final BigDecimal interestRatePerPeriod, final EnumOptionData interestRateFrequencyType, final EnumOptionData amortizationType, final BigDecimal interestRatePerPeriod, final EnumOptionData interestRateFrequencyType,
final BigDecimal annualInterestRate, final EnumOptionData interestType, final boolean isFloatingInterestRate, final BigDecimal annualInterestRate, final EnumOptionData interestType, final boolean isFloatingInterestRate,
final BigDecimal interestRateDifferential, final EnumOptionData interestCalculationPeriodType, final BigDecimal interestRateDifferential, final EnumOptionData interestCalculationPeriodType,
final Boolean allowPartialPeriodInterestCalcualtion, final LocalDate expectedFirstRepaymentOnDate, final Boolean allowPartialPeriodInterestCalculation, final LocalDate expectedFirstRepaymentOnDate,
final Integer graceOnPrincipalPayment, final Integer recurringMoratoriumOnPrincipalPeriods, final Integer graceOnPrincipalPayment, final Integer recurringMoratoriumOnPrincipalPeriods,
final Integer graceOnInterestPayment, final Integer graceOnInterestCharged, final LocalDate interestChargedFromDate, final Integer graceOnInterestPayment, final Integer graceOnInterestCharged, final LocalDate interestChargedFromDate,
final LoanApplicationTimelineData timeline, final LoanSummaryData summary, final BigDecimal feeChargesDueAtDisbursementCharged, final LoanApplicationTimelineData timeline, final LoanSummaryData summary, final BigDecimal feeChargesDueAtDisbursementCharged,
@@ -1663,7 +1632,7 @@ public final class LoanAccountData {
this.isFloatingInterestRate = isFloatingInterestRate; this.isFloatingInterestRate = isFloatingInterestRate;
this.interestRateDifferential = interestRateDifferential; this.interestRateDifferential = interestRateDifferential;
this.interestCalculationPeriodType = interestCalculationPeriodType; this.interestCalculationPeriodType = interestCalculationPeriodType;
this.allowPartialPeriodInterestCalcualtion = allowPartialPeriodInterestCalcualtion; this.allowPartialPeriodInterestCalculation = allowPartialPeriodInterestCalculation;
this.expectedFirstRepaymentOnDate = expectedFirstRepaymentOnDate; this.expectedFirstRepaymentOnDate = expectedFirstRepaymentOnDate;
this.graceOnPrincipalPayment = graceOnPrincipalPayment; this.graceOnPrincipalPayment = graceOnPrincipalPayment;
this.recurringMoratoriumOnPrincipalPeriods = recurringMoratoriumOnPrincipalPeriods; this.recurringMoratoriumOnPrincipalPeriods = recurringMoratoriumOnPrincipalPeriods;
@@ -1759,7 +1728,7 @@ public final class LoanAccountData {
this.fixedEmiAmount = fixedEmiAmount; this.fixedEmiAmount = fixedEmiAmount;
this.maxOutstandingLoanBalance = maxOutstandingLoanBalance; this.maxOutstandingLoanBalance = maxOutstandingLoanBalance;
if (this.status != null && LoanStatus.fromInt(this.status.id().intValue()).isApproved()) { if (this.status != null && LoanStatus.fromInt(this.status.getId().intValue()).isApproved()) {
this.canDisburse = true; this.canDisburse = true;
} else { } else {
boolean canDisburse = false; boolean canDisburse = false;
@@ -1788,7 +1757,7 @@ public final class LoanAccountData {
this.createStandingInstructionAtDisbursement = createStandingInstructionAtDisbursement; this.createStandingInstructionAtDisbursement = createStandingInstructionAtDisbursement;
this.paidInAdvance = paidInAdvance; this.paidInAdvance = paidInAdvance;
if (this.product != null) { if (this.product != null) {
this.product.setLoanProductConfigurableAttributes(product.getLoanProductConfigurableAttributes()); this.product.setLoanProductConfigurableAttributes(product.getAllowAttributeOverrides());
} }
this.interestRatesPeriods = interestRatesPeriods; this.interestRatesPeriods = interestRatesPeriods;
this.isVariableInstallmentsAllowed = isVariableInstallmentsAllowed; this.isVariableInstallmentsAllowed = isVariableInstallmentsAllowed;
@@ -1820,14 +1789,6 @@ public final class LoanAccountData {
return officeId; return officeId;
} }
public Long loanOfficerId() {
return this.loanOfficerId;
}
public Collection<LoanChargeData> charges() {
return this.charges;
}
public Long groupOfficeId() { public Long groupOfficeId() {
return this.group == null ? null : this.group.officeId(); return this.group == null ? null : this.group.officeId();
} }
@@ -1836,14 +1797,6 @@ public final class LoanAccountData {
return this.group == null ? null : this.group.getId(); return this.group == null ? null : this.group.getId();
} }
public CurrencyData currency() {
return this.currency;
}
public Long clientId() {
return this.clientId;
}
private static BigDecimal fetchLoanCycleDefaultValue(Collection<LoanProductBorrowerCycleVariationData> borrowerCycleVariationData, private static BigDecimal fetchLoanCycleDefaultValue(Collection<LoanProductBorrowerCycleVariationData> borrowerCycleVariationData,
Integer loanCycleNumber) { Integer loanCycleNumber) {
BigDecimal defaultValue = null; BigDecimal defaultValue = null;
@@ -1862,31 +1815,19 @@ public final class LoanAccountData {
private static boolean isLoanCycleValuesWhenConditionGreterthan(Integer loanCycleNumber, Integer cycleNumberSelected, private static boolean isLoanCycleValuesWhenConditionGreterthan(Integer loanCycleNumber, Integer cycleNumberSelected,
LoanProductBorrowerCycleVariationData data) { LoanProductBorrowerCycleVariationData data) {
return data.getBorrowerCycleNumber() < loanCycleNumber return data.getBorrowerCycleNumber() < loanCycleNumber
&& data.getValueConditionType().equals(LoanProductValueConditionType.GREATERTHAN) && data.getLoanProductValueConditionType().equals(LoanProductValueConditionType.GREATERTHAN)
&& cycleNumberSelected < data.getBorrowerCycleNumber(); && cycleNumberSelected < data.getBorrowerCycleNumber();
} }
private static boolean isLoanCycleValuesWhenConditionEqual(Integer loanCycleNumber, LoanProductBorrowerCycleVariationData data) { private static boolean isLoanCycleValuesWhenConditionEqual(Integer loanCycleNumber, LoanProductBorrowerCycleVariationData data) {
return data.getBorrowerCycleNumber().equals(loanCycleNumber) return data.getBorrowerCycleNumber().equals(loanCycleNumber)
&& data.getValueConditionType().equals(LoanProductValueConditionType.EQUAL); && data.getLoanProductValueConditionType().equals(LoanProductValueConditionType.EQUAL);
}
public LoanProductData product() {
return this.product;
} }
public void setProduct(LoanProductData product) { public void setProduct(LoanProductData product) {
this.product = product; this.product = product;
} }
public GroupGeneralData groupData() {
return this.group;
}
public Long loanProductId() {
return this.loanProductId;
}
public BigDecimal getTotalOutstandingAmount() { public BigDecimal getTotalOutstandingAmount() {
if (this.summary != null) { if (this.summary != null) {
return this.summary.getTotalOutstanding(); return this.summary.getTotalOutstanding();
@@ -1895,28 +1836,28 @@ public final class LoanAccountData {
} }
} }
public boolean isIsInterestRecalculationEnabled() {
return this.isInterestRecalculationEnabled;
}
public boolean isInterestRecalculationEnabled() { public boolean isInterestRecalculationEnabled() {
return this.isInterestRecalculationEnabled; return this.isInterestRecalculationEnabled;
} }
public Long getInterestRecalculationDetailId() { public Long getInterestRecalculationDetailId() {
if (isInterestRecalculationEnabled()) { if (isInterestRecalculationEnabled) {
return this.interestRecalculationData.getId(); return this.interestRecalculationData.getId();
} }
return null; return null;
} }
public boolean isActive() { public boolean isActive() {
return LoanStatus.fromInt(this.status.id().intValue()).isActive(); return LoanStatus.fromInt(this.status.getId().intValue()).isActive();
}
public boolean isMultiDisburseLoan() {
return multiDisburseLoan;
} }
public BigDecimal getTotalPaidFeeCharges() { public BigDecimal getTotalPaidFeeCharges() {
if (this.summary != null) { if (this.summary != null) {
return this.summary.getTotalPaidFeeCharges(); return this.summary.getFeeChargesPaid();
} }
return BigDecimal.ZERO; return BigDecimal.ZERO;
} }
@@ -1936,6 +1877,10 @@ public final class LoanAccountData {
return LoanAccountData.collateralTemplate(loanCollateralOptions); return LoanAccountData.collateralTemplate(loanCollateralOptions);
} }
public boolean isIsLoanProductLinkedToFloatingRate() {
return this.isLoanProductLinkedToFloatingRate;
}
public boolean isLoanProductLinkedToFloatingRate() { public boolean isLoanProductLinkedToFloatingRate() {
return this.isLoanProductLinkedToFloatingRate; return this.isLoanProductLinkedToFloatingRate;
} }
@@ -1948,12 +1893,8 @@ public final class LoanAccountData {
return this.isFloatingInterestRate; return this.isFloatingInterestRate;
} }
public BigDecimal getInterestRateDifferential() { public boolean isIsFloatingInterestRate() {
return this.interestRateDifferential; return this.isFloatingInterestRate;
}
public BigDecimal getNetDisbursalAmount() {
return netDisbursalAmount;
} }
public void setDatatables(final List<DatatableData> datatables) { public void setDatatables(final List<DatatableData> datatables) {
@@ -1961,7 +1902,14 @@ public final class LoanAccountData {
} }
public String getStatusStringValue() { public String getStatusStringValue() {
return this.status.value(); return this.status.getValue();
} }
public boolean isTopup() {
return isTopup;
}
public boolean isIsTopup() {
return isTopup;
}
} }
@@ -20,12 +20,15 @@ package org.apache.fineract.portfolio.loanaccount.data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.organisation.monetary.data.CurrencyData; import org.apache.fineract.organisation.monetary.data.CurrencyData;
/** /**
* Immutable data object represent the important time-line events of a loan application and loan. * Immutable data object represent the important time-line events of a loan application and loan.
*/ */
@SuppressWarnings("unused") @Getter
@RequiredArgsConstructor
public class LoanApplicationTimelineData { public class LoanApplicationTimelineData {
private final LocalDate submittedOnDate; private final LocalDate submittedOnDate;
@@ -99,48 +102,6 @@ public class LoanApplicationTimelineData {
writeOffByUsername, writeOffByFirstname, writeOffByLastname); writeOffByUsername, writeOffByFirstname, writeOffByLastname);
} }
public LoanApplicationTimelineData(final LocalDate submittedOnDate, final String submittedByUsername, final String submittedByFirstname,
final String submittedByLastname, final LocalDate rejectedOnDate, final String rejectedByUsername,
final String rejectedByFirstname, final String rejectedByLastname, final LocalDate withdrawnOnDate,
final String withdrawnByUsername, final String withdrawnByFirstname, final String withdrawnByLastname,
final LocalDate approvedOnDate, final String approvedByUsername, final String approvedByFirstname,
final String approvedByLastname, final LocalDate expectedDisbursementDate, final LocalDate actualDisbursementDate,
final String disbursedByUsername, final String disbursedByFirstname, final String disbursedByLastname,
final LocalDate closedOnDate, final String closedByUsername, final String closedByFirstname, final String closedByLastname,
final LocalDate expectedMaturityDate, final LocalDate writeOffOnDate, final String writeOffByUsername,
final String writeOffByFirstname, final String writeOffByLastname) {
this.submittedOnDate = submittedOnDate;
this.submittedByUsername = submittedByUsername;
this.submittedByFirstname = submittedByFirstname;
this.submittedByLastname = submittedByLastname;
this.rejectedOnDate = rejectedOnDate;
this.rejectedByUsername = rejectedByUsername;
this.rejectedByFirstname = rejectedByFirstname;
this.rejectedByLastname = rejectedByLastname;
this.withdrawnOnDate = withdrawnOnDate;
this.withdrawnByUsername = withdrawnByUsername;
this.withdrawnByFirstname = withdrawnByFirstname;
this.withdrawnByLastname = withdrawnByLastname;
this.approvedOnDate = approvedOnDate;
this.approvedByUsername = approvedByUsername;
this.approvedByFirstname = approvedByFirstname;
this.approvedByLastname = approvedByLastname;
this.expectedDisbursementDate = expectedDisbursementDate;
this.actualDisbursementDate = actualDisbursementDate;
this.disbursedByUsername = disbursedByUsername;
this.disbursedByFirstname = disbursedByFirstname;
this.disbursedByLastname = disbursedByLastname;
this.closedOnDate = closedOnDate;
this.closedByUsername = closedByUsername;
this.closedByFirstname = closedByFirstname;
this.closedByLastname = closedByLastname;
this.expectedMaturityDate = expectedMaturityDate;
this.writeOffOnDate = writeOffOnDate;
this.writeOffByUsername = writeOffByUsername;
this.writeOffByFirstname = writeOffByFirstname;
this.writeOffByLastname = writeOffByLastname;
}
public RepaymentScheduleRelatedLoanData repaymentScheduleRelatedData(final CurrencyData currency, final BigDecimal principal, public RepaymentScheduleRelatedLoanData repaymentScheduleRelatedData(final CurrencyData currency, final BigDecimal principal,
final BigDecimal approvedPrincipal, final BigDecimal inArrearsTolerance, final BigDecimal totalFeeChargesAtDisbursement) { final BigDecimal approvedPrincipal, final BigDecimal inArrearsTolerance, final BigDecimal totalFeeChargesAtDisbursement) {
return new RepaymentScheduleRelatedLoanData(this.expectedDisbursementDate, this.actualDisbursementDate, currency, principal, return new RepaymentScheduleRelatedLoanData(this.expectedDisbursementDate, this.actualDisbursementDate, currency, principal,
@@ -19,24 +19,15 @@
package org.apache.fineract.portfolio.loanaccount.data; package org.apache.fineract.portfolio.loanaccount.data;
import java.math.BigDecimal; import java.math.BigDecimal;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
@Getter
public class LoanBorrowerCycleData { public class LoanBorrowerCycleData {
@SuppressWarnings("unused")
private final BigDecimal principal; private final BigDecimal principal;
@SuppressWarnings("unused")
private final BigDecimal interestRatePerPeriod; private final BigDecimal interestRatePerPeriod;
@SuppressWarnings("unused")
private final Integer numberOfRepayments; private final Integer numberOfRepayments;
@SuppressWarnings("unused")
private final Integer termFrequency; private final Integer termFrequency;
public LoanBorrowerCycleData(final BigDecimal principal, final BigDecimal interestRatePerPeriod, final Integer numberOfRepayments,
final Integer termFrequency) {
this.principal = principal;
this.interestRatePerPeriod = interestRatePerPeriod;
this.numberOfRepayments = numberOfRepayments;
this.termFrequency = termFrequency;
}
} }
@@ -21,6 +21,7 @@ package org.apache.fineract.portfolio.loanaccount.data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.Collection; import java.util.Collection;
import lombok.Getter;
import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.organisation.monetary.data.CurrencyData; import org.apache.fineract.organisation.monetary.data.CurrencyData;
import org.apache.fineract.portfolio.charge.data.ChargeData; import org.apache.fineract.portfolio.charge.data.ChargeData;
@@ -30,6 +31,7 @@ import org.apache.fineract.portfolio.charge.domain.ChargeTimeType;
/** /**
* Immutable data object for loan charge data. * Immutable data object for loan charge data.
*/ */
@Getter
public class LoanChargeData { public class LoanChargeData {
private final Long id; private final Long id;
@@ -381,22 +383,6 @@ public class LoanChargeData {
return isAccountTransfer && !this.paid && !this.waived; return isAccountTransfer && !this.paid && !this.waived;
} }
public Long getId() {
return this.id;
}
public LocalDate getDueDate() {
return this.dueDate;
}
public Long getLoanId() {
return this.loanId;
}
public BigDecimal getAmountOutstanding() {
return this.amountOutstanding;
}
public boolean isInstallmentFee() { public boolean isInstallmentFee() {
boolean isInstalmentFee = false; boolean isInstalmentFee = false;
if (this.chargeTimeType != null) { if (this.chargeTimeType != null) {
@@ -405,48 +391,7 @@ public class LoanChargeData {
return isInstalmentFee; return isInstalmentFee;
} }
public EnumOptionData getChargeCalculationType() {
return chargeCalculationType;
}
public BigDecimal amountOrPercentage() {
return this.amountOrPercentage;
}
public Collection<LoanInstallmentChargeData> getInstallmentChargeData() {
return this.installmentChargeData;
}
public boolean isPenalty() {
return this.penalty;
}
public BigDecimal getAmount() {
return this.amount;
}
public BigDecimal getAmountAccrued() {
return this.amountAccrued;
}
public void updateAmountAccrued(BigDecimal amountAccrued) { public void updateAmountAccrued(BigDecimal amountAccrued) {
this.amountAccrued = amountAccrued; this.amountAccrued = amountAccrued;
} }
public Long getChargeId() {
return this.chargeId;
}
public BigDecimal getAmountWaived() {
return this.amountWaived;
}
public BigDecimal getAmountUnrecognized() {
return this.amountUnrecognized;
}
public String getExternalId() {
return externalId;
}
} }
@@ -19,7 +19,11 @@
package org.apache.fineract.portfolio.loanaccount.data; package org.apache.fineract.portfolio.loanaccount.data;
import java.math.BigDecimal; import java.math.BigDecimal;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@Getter
@RequiredArgsConstructor
public class LoanChargePaidByData { public class LoanChargePaidByData {
private final Long id; private final Long id;
@@ -29,16 +33,6 @@ public class LoanChargePaidByData {
private final Long transactionId; private final Long transactionId;
private final String name; private final String name;
public LoanChargePaidByData(final Long id, final BigDecimal amount, final Integer installmentNumber, final Long chargeId,
final Long transactionId, String name) {
this.id = id;
this.amount = amount;
this.installmentNumber = installmentNumber;
this.chargeId = chargeId;
this.transactionId = transactionId;
this.name = name;
}
public LoanChargePaidByData(final Long id, final BigDecimal amount, final Integer installmentNumber, final Long chargeId, public LoanChargePaidByData(final Long id, final BigDecimal amount, final Integer installmentNumber, final Long chargeId,
final Long transactionId) { final Long transactionId) {
this.id = id; this.id = id;
@@ -49,27 +43,4 @@ public class LoanChargePaidByData {
this.name = null; this.name = null;
} }
public Long getId() {
return this.id;
}
public BigDecimal getAmount() {
return this.amount;
}
public Integer getInstallmentNumber() {
return this.installmentNumber;
}
public Long getChargeId() {
return this.chargeId;
}
public Long getTransactionId() {
return this.transactionId;
}
public String getName() {
return name;
}
} }
@@ -19,7 +19,11 @@
package org.apache.fineract.portfolio.loanaccount.data; package org.apache.fineract.portfolio.loanaccount.data;
import java.math.BigDecimal; import java.math.BigDecimal;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
@Getter
public class LoanCollateralManagementData { public class LoanCollateralManagementData {
private final Long clientCollateralId; private final Long clientCollateralId;
@@ -31,30 +35,4 @@ public class LoanCollateralManagementData {
private final BigDecimal totalCollateral; private final BigDecimal totalCollateral;
private final Long id; private final Long id;
public LoanCollateralManagementData(final Long clientCollateralIdId, final BigDecimal quantity, final BigDecimal total,
final BigDecimal totalCollateral, final Long id) {
this.clientCollateralId = clientCollateralIdId;
this.quantity = quantity;
this.totalCollateral = totalCollateral;
this.total = total;
this.id = id;
}
public Long getClientCollateralId() {
return this.clientCollateralId;
}
public BigDecimal getQuantity() {
return this.quantity;
}
public BigDecimal getTotal() {
return this.total;
}
public BigDecimal getTotalCollateral() {
return this.totalCollateral;
}
} }
@@ -20,7 +20,9 @@ package org.apache.fineract.portfolio.loanaccount.data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import lombok.Getter;
@Getter
public class LoanInstallmentChargeData { public class LoanInstallmentChargeData {
private final Integer installmentNumber; private final Integer installmentNumber;
@@ -70,36 +72,7 @@ public class LoanInstallmentChargeData {
this.amountUnrecognized = amountUnrecognized; this.amountUnrecognized = amountUnrecognized;
} }
public Integer getInstallmentNumber() {
return this.installmentNumber;
}
public LocalDate getDueDate() {
return this.dueDate;
}
public boolean isPaymentPending() { public boolean isPaymentPending() {
return !(this.paid || this.waived); return !(this.paid || this.waived);
} }
public BigDecimal getAmountOutstanding() {
return this.amountOutstanding;
}
public BigDecimal getAmount() {
return this.amount;
}
public BigDecimal getAmountWaived() {
return this.amountWaived;
}
public BigDecimal getAmountAccrued() {
return this.amountAccrued;
}
public BigDecimal getAmountUnrecognized() {
return this.amountUnrecognized;
}
} }
@@ -18,31 +18,29 @@
*/ */
package org.apache.fineract.portfolio.loanaccount.data; package org.apache.fineract.portfolio.loanaccount.data;
import lombok.Getter;
import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.portfolio.calendar.data.CalendarData; import org.apache.fineract.portfolio.calendar.data.CalendarData;
@Getter
public class LoanInterestRecalculationData { public class LoanInterestRecalculationData {
private final Long id; private final Long id;
private final Long loanId; private final Long loanId;
private final EnumOptionData interestRecalculationCompoundingType; private final EnumOptionData interestRecalculationCompoundingType;
private final EnumOptionData rescheduleStrategyType; private final EnumOptionData rescheduleStrategyType;
@SuppressWarnings("unused")
private final CalendarData calendarData; private final CalendarData calendarData;
private final EnumOptionData recalculationRestFrequencyType; private final EnumOptionData recalculationRestFrequencyType;
private final Integer recalculationRestFrequencyInterval; private final Integer recalculationRestFrequencyInterval;
/* private final LocalDate recalculationRestFrequencyDate; */
private final EnumOptionData recalculationRestFrequencyNthDay; private final EnumOptionData recalculationRestFrequencyNthDay;
private final EnumOptionData recalculationRestFrequencyWeekday; private final EnumOptionData recalculationRestFrequencyWeekday;
private final Integer recalculationRestFrequencyOnDay; private final Integer recalculationRestFrequencyOnDay;
private final EnumOptionData recalculationCompoundingFrequencyType; private final EnumOptionData recalculationCompoundingFrequencyType;
private final Integer recalculationCompoundingFrequencyInterval; private final Integer recalculationCompoundingFrequencyInterval;
/* private final LocalDate recalculationCompoundingFrequencyDate; */
private final EnumOptionData recalculationCompoundingFrequencyNthDay; private final EnumOptionData recalculationCompoundingFrequencyNthDay;
private final EnumOptionData recalculationCompoundingFrequencyWeekday; private final EnumOptionData recalculationCompoundingFrequencyWeekday;
private final Integer recalculationCompoundingFrequencyOnDay; private final Integer recalculationCompoundingFrequencyOnDay;
private final Boolean isCompoundingToBePostedAsTransaction; private final Boolean isCompoundingToBePostedAsTransaction;
@SuppressWarnings("unused")
private final CalendarData compoundingCalendarData; private final CalendarData compoundingCalendarData;
private final Boolean allowCompoundingOnEod; private final Boolean allowCompoundingOnEod;
@@ -88,8 +86,4 @@ public class LoanInterestRecalculationData {
recalculationData.allowCompoundingOnEod); recalculationData.allowCompoundingOnEod);
} }
public Long getId() {
return this.id;
}
} }
@@ -20,7 +20,11 @@ package org.apache.fineract.portfolio.loanaccount.data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor
@Getter
public final class LoanRepaymentScheduleInstallmentData { public final class LoanRepaymentScheduleInstallmentData {
private Long id; private Long id;
@@ -31,14 +35,6 @@ public final class LoanRepaymentScheduleInstallmentData {
private BigDecimal amount; private BigDecimal amount;
private LoanRepaymentScheduleInstallmentData(final Long id, final Integer installmentId, final LocalDate date,
final BigDecimal amount) {
this.amount = amount;
this.date = date;
this.installmentId = installmentId;
this.id = id;
}
public static LoanRepaymentScheduleInstallmentData instanceOf(final Long id, final Integer installmentId, final LocalDate date, public static LoanRepaymentScheduleInstallmentData instanceOf(final Long id, final Integer installmentId, final LocalDate date,
final BigDecimal amount) { final BigDecimal amount) {
return new LoanRepaymentScheduleInstallmentData(id, installmentId, date, amount); return new LoanRepaymentScheduleInstallmentData(id, installmentId, date, amount);
@@ -18,10 +18,12 @@
*/ */
package org.apache.fineract.portfolio.loanaccount.data; package org.apache.fineract.portfolio.loanaccount.data;
import lombok.Getter;
/** /**
* Immutable data object represent loan status enumerations. * Immutable data object represent loan status enumerations.
*/ */
@SuppressWarnings("unused") @Getter
public class LoanStatusEnumData { public class LoanStatusEnumData {
private final Long id; private final Long id;
@@ -49,16 +51,4 @@ public class LoanStatusEnumData {
this.closed = this.closedObligationsMet || this.closedWrittenOff || this.closedRescheduled; this.closed = this.closedObligationsMet || this.closedWrittenOff || this.closedRescheduled;
this.overpaid = Long.valueOf(700).equals(this.id); this.overpaid = Long.valueOf(700).equals(this.id);
} }
public Long id() {
return this.id;
}
public String code() {
return this.code;
}
public String value() {
return this.value;
}
} }
@@ -20,12 +20,13 @@ package org.apache.fineract.portfolio.loanaccount.data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import lombok.Getter;
import org.apache.fineract.organisation.monetary.data.CurrencyData; import org.apache.fineract.organisation.monetary.data.CurrencyData;
/** /**
* Immutable data object representing loan summary information. * Immutable data object representing loan summary information.
*/ */
@SuppressWarnings("unused") @Getter
public class LoanSummaryData { public class LoanSummaryData {
private final CurrencyData currency; private final CurrencyData currency;
@@ -116,12 +117,4 @@ public class LoanSummaryData {
this.writeoffReason = writeoffReason; this.writeoffReason = writeoffReason;
this.totalRecovered = totalRecovered; this.totalRecovered = totalRecovered;
} }
public BigDecimal getTotalOutstanding() {
return this.totalOutstanding;
}
public BigDecimal getTotalPaidFeeCharges() {
return feeChargesPaid;
}
} }
@@ -20,12 +20,13 @@ package org.apache.fineract.portfolio.loanaccount.data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import lombok.Getter;
import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.portfolio.loanaccount.domain.LoanTermVariationType; import org.apache.fineract.portfolio.loanaccount.domain.LoanTermVariationType;
@Getter
public class LoanTermVariationsData implements Comparable<LoanTermVariationsData> { public class LoanTermVariationsData implements Comparable<LoanTermVariationsData> {
@SuppressWarnings("unused")
private final Long id; private final Long id;
private final EnumOptionData termType; private final EnumOptionData termType;
private LocalDate termVariationApplicableFrom; private LocalDate termVariationApplicableFrom;
@@ -54,22 +55,10 @@ public class LoanTermVariationsData implements Comparable<LoanTermVariationsData
this.isSpecificToInstallment = isSpecificToInstallment; this.isSpecificToInstallment = isSpecificToInstallment;
} }
public EnumOptionData getTermType() {
return this.termType;
}
public LoanTermVariationType getTermVariationType() { public LoanTermVariationType getTermVariationType() {
return LoanTermVariationType.fromInt(this.termType.getId().intValue()); return LoanTermVariationType.fromInt(this.termType.getId().intValue());
} }
public LocalDate getTermApplicableFrom() {
return this.termVariationApplicableFrom;
}
public BigDecimal getDecimalValue() {
return this.decimalValue;
}
public boolean isApplicable(final LocalDate fromDate, final LocalDate dueDate) { public boolean isApplicable(final LocalDate fromDate, final LocalDate dueDate) {
return occursOnDayFromAndUpTo(fromDate, dueDate, this.termVariationApplicableFrom); return occursOnDayFromAndUpTo(fromDate, dueDate, this.termVariationApplicableFrom);
} }
@@ -86,11 +75,11 @@ public class LoanTermVariationsData implements Comparable<LoanTermVariationsData
return target != null && !target.isAfter(date); return target != null && !target.isAfter(date);
} }
public LocalDate getDateValue() { public boolean isSpecificToInstallment() {
return this.dateValue; return this.isSpecificToInstallment;
} }
public boolean isSpecificToInstallment() { public boolean isIsSpecificToInstallment() {
return this.isSpecificToInstallment; return this.isSpecificToInstallment;
} }
@@ -104,7 +93,7 @@ public class LoanTermVariationsData implements Comparable<LoanTermVariationsData
@Override @Override
public int compareTo(LoanTermVariationsData o) { public int compareTo(LoanTermVariationsData o) {
int comparsion = getTermApplicableFrom().compareTo(o.getTermApplicableFrom()); int comparsion = getTermVariationApplicableFrom().compareTo(o.getTermVariationApplicableFrom());
if (comparsion == 0) { if (comparsion == 0) {
if (o.getTermVariationType().isDueDateVariation() || o.getTermVariationType().isInsertInstallment()) { if (o.getTermVariationType().isDueDateVariation() || o.getTermVariationType().isInsertInstallment()) {
comparsion = 1; comparsion = 1;
@@ -54,7 +54,7 @@ public class LoanTermVariationsDataWrapper {
boolean hasVariation = false; boolean hasVariation = false;
if (iterator.hasNext()) { if (iterator.hasNext()) {
LoanTermVariationsData loanTermVariationsData = iterator.next(); LoanTermVariationsData loanTermVariationsData = iterator.next();
if (!loanTermVariationsData.getTermApplicableFrom().isAfter(date)) { if (!loanTermVariationsData.getTermVariationApplicableFrom().isAfter(date)) {
hasVariation = true; hasVariation = true;
} }
iterator.previous(); iterator.previous();
@@ -123,7 +123,7 @@ public class LoanTermVariationsDataWrapper {
public LoanTermVariationsData fetchLoanTermDueDateVariationsData(final LocalDate onDate) { public LoanTermVariationsData fetchLoanTermDueDateVariationsData(final LocalDate onDate) {
LoanTermVariationsData data = null; LoanTermVariationsData data = null;
for (LoanTermVariationsData termVariationsData : this.dueDateVariation) { for (LoanTermVariationsData termVariationsData : this.dueDateVariation) {
if (onDate.isEqual(termVariationsData.getTermApplicableFrom())) { if (onDate.isEqual(termVariationsData.getTermVariationApplicableFrom())) {
data = termVariationsData; data = termVariationsData;
break; break;
} }
@@ -22,6 +22,7 @@ import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import lombok.Getter;
import org.apache.fineract.infrastructure.codes.data.CodeValueData; import org.apache.fineract.infrastructure.codes.data.CodeValueData;
import org.apache.fineract.organisation.monetary.data.CurrencyData; import org.apache.fineract.organisation.monetary.data.CurrencyData;
import org.apache.fineract.portfolio.account.data.AccountTransferData; import org.apache.fineract.portfolio.account.data.AccountTransferData;
@@ -31,7 +32,7 @@ import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
/** /**
* Immutable data object representing a loan transaction. * Immutable data object representing a loan transaction.
*/ */
@SuppressWarnings("unused") @Getter
public class LoanTransactionData { public class LoanTransactionData {
private final Long id; private final Long id;
@@ -186,14 +187,6 @@ public class LoanTransactionData {
this.loanRepaymentScheduleInstallments = loanRepaymentScheduleInstallments; this.loanRepaymentScheduleInstallments = loanRepaymentScheduleInstallments;
} }
public Long getAccountId() {
return accountId;
}
public Integer getRowIndex() {
return rowIndex;
}
public static LoanTransactionData templateOnTop(final LoanTransactionData loanTransactionData, public static LoanTransactionData templateOnTop(final LoanTransactionData loanTransactionData,
final Collection<PaymentTypeData> paymentTypeOptions) { final Collection<PaymentTypeData> paymentTypeOptions) {
return new LoanTransactionData(loanTransactionData.id, loanTransactionData.officeId, loanTransactionData.officeName, return new LoanTransactionData(loanTransactionData.id, loanTransactionData.officeId, loanTransactionData.officeName,
@@ -344,38 +337,14 @@ public class LoanTransactionData {
this.possibleNextRepaymentDate = possibleNextRepaymentDate; this.possibleNextRepaymentDate = possibleNextRepaymentDate;
} }
public LocalDate dateOf() {
return this.date;
}
public boolean isNotDisbursement() { public boolean isNotDisbursement() {
return type.id() == 1; return type.getId() == 1;
}
public BigDecimal getAmount() {
return this.amount;
}
public BigDecimal getNetDisbursalAmount() {
return netDisbursalAmount;
}
public BigDecimal getUnrecognizedIncomePortion() {
return this.unrecognizedIncomePortion;
}
public BigDecimal getInterestPortion() {
return this.interestPortion;
} }
public void setWriteOffReasonOptions(Collection<CodeValueData> writeOffReasonOptions) { public void setWriteOffReasonOptions(Collection<CodeValueData> writeOffReasonOptions) {
this.writeOffReasonOptions = writeOffReasonOptions; this.writeOffReasonOptions = writeOffReasonOptions;
} }
public Collection<LoanChargePaidByData> getLoanChargePaidByList() {
return loanChargePaidByList;
}
public void setLoanChargePaidByList(Collection<LoanChargePaidByData> loanChargePaidByList) { public void setLoanChargePaidByList(Collection<LoanChargePaidByData> loanChargePaidByList) {
this.loanChargePaidByList = loanChargePaidByList; this.loanChargePaidByList = loanChargePaidByList;
} }
@@ -18,10 +18,12 @@
*/ */
package org.apache.fineract.portfolio.loanaccount.data; package org.apache.fineract.portfolio.loanaccount.data;
import lombok.Getter;
/** /**
* Immutable data object represent loan status enumerations. * Immutable data object represent loan status enumerations.
*/ */
@SuppressWarnings("unused") @Getter
public class LoanTransactionEnumData { public class LoanTransactionEnumData {
private final Long id; private final Long id;
@@ -80,18 +82,6 @@ public class LoanTransactionEnumData {
this.chargeback = Long.valueOf(25).equals(this.id); this.chargeback = Long.valueOf(25).equals(this.id);
} }
public Long id() {
return this.id;
}
public String getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
/** /**
* Returns true if the transaction involves either a payment (disbursement) or a receipt (repayments, repayments * Returns true if the transaction involves either a payment (disbursement) or a receipt (repayments, repayments
* during disbursement etc) * during disbursement etc)
@@ -111,89 +101,4 @@ public class LoanTransactionEnumData {
} }
return false; return false;
} }
public boolean isDisbursement() {
return this.disbursement;
}
public boolean isRepaymentAtDisbursement() {
return this.repaymentAtDisbursement;
}
public boolean isRepayment() {
return this.repayment;
}
public boolean isMerchantIssuedRefund() {
return this.merchantIssuedRefund;
}
public boolean isPayoutRefund() {
return this.payoutRefund;
}
public boolean isGoodwillCredit() {
return this.goodwillCredit;
}
public boolean isChargeRefund() {
return this.chargeRefund;
}
public boolean isWaiveInterest() {
return this.waiveInterest;
}
public boolean isWaiveCharges() {
return this.waiveCharges;
}
public boolean isWriteOff() {
return this.writeOff;
}
public boolean isRecoveryRepayment() {
return this.recoveryRepayment;
}
public boolean isAccrual() {
return this.accrual;
}
public boolean isInitiateTransfer() {
return this.initiateTransfer;
}
public boolean isApproveTransfer() {
return this.approveTransfer;
}
public boolean isWithdrawTransfer() {
return this.withdrawTransfer;
}
public boolean isRejectTransfer() {
return this.rejectTransfer;
}
public boolean isChargePayment() {
return this.chargePayment;
}
public boolean isRefund() {
return this.refund;
}
public boolean isRefundForActiveLoans() {
return this.refundForActiveLoans;
}
public boolean isCreditBalanceRefund() {
return this.creditBalanceRefund;
}
public boolean isChargeback() {
return this.chargeback;
}
} }
@@ -19,17 +19,13 @@
package org.apache.fineract.portfolio.loanaccount.data; package org.apache.fineract.portfolio.loanaccount.data;
import java.math.BigDecimal; import java.math.BigDecimal;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@Getter
@RequiredArgsConstructor
public class PaidInAdvanceData { public class PaidInAdvanceData {
private final BigDecimal paidInAdvance; private final BigDecimal paidInAdvance;
public PaidInAdvanceData(final BigDecimal paidInAdvance) {
this.paidInAdvance = paidInAdvance;
}
public BigDecimal getPaidInAdvance() {
return paidInAdvance;
}
} }
@@ -6768,7 +6768,7 @@ public class Loan extends AbstractAuditableWithUTCDateTimeCustom {
if (this.isMultiDisburmentLoan()) { if (this.isMultiDisburmentLoan()) {
List<DisbursementData> disbursementData = getDisbursmentData(); List<DisbursementData> disbursementData = getDisbursmentData();
Collections.sort(disbursementData); Collections.sort(disbursementData);
firstDisbursalAmount = disbursementData.get(disbursementData.size() - 1).amount(); firstDisbursalAmount = disbursementData.get(disbursementData.size() - 1).getPrincipal();
} else { } else {
firstDisbursalAmount = this.getLoanRepaymentScheduleDetail().getPrincipal().getAmount(); firstDisbursalAmount = this.getLoanRepaymentScheduleDetail().getPrincipal().getAmount();
} }
@@ -25,6 +25,6 @@ public class LoanRepaymentDataComparator implements Comparator<LoanTransactionDa
@Override @Override
public int compare(final LoanTransactionData o1, final LoanTransactionData o2) { public int compare(final LoanTransactionData o1, final LoanTransactionData o2) {
return o2.dateOf().compareTo(o1.dateOf()); return o2.getDate().compareTo(o1.getDate());
} }
} }
@@ -22,6 +22,7 @@ import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import lombok.Getter;
import org.apache.fineract.infrastructure.codes.data.CodeValueData; import org.apache.fineract.infrastructure.codes.data.CodeValueData;
import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.organisation.staff.data.StaffData; import org.apache.fineract.organisation.staff.data.StaffData;
@@ -30,6 +31,7 @@ import org.apache.fineract.portfolio.client.data.ClientData;
import org.apache.fineract.portfolio.loanaccount.guarantor.domain.GuarantorType; import org.apache.fineract.portfolio.loanaccount.guarantor.domain.GuarantorType;
import org.apache.fineract.portfolio.loanaccount.guarantor.service.GuarantorEnumerations; import org.apache.fineract.portfolio.loanaccount.guarantor.service.GuarantorEnumerations;
@Getter
public class GuarantorData { public class GuarantorData {
private final Long id; private final Long id;
@@ -122,14 +124,6 @@ public class GuarantorData {
this.accountLinkingOptions = null; this.accountLinkingOptions = null;
} }
public Long getAccountId() {
return accountId;
}
public Integer getRowIndex() {
return rowIndex;
}
public static GuarantorData template(final List<EnumOptionData> guarantorTypeOptions, public static GuarantorData template(final List<EnumOptionData> guarantorTypeOptions,
final Collection<CodeValueData> allowedClientRelationshipTypes, Collection<PortfolioAccountData> accountLinkingOptions) { final Collection<CodeValueData> allowedClientRelationshipTypes, Collection<PortfolioAccountData> accountLinkingOptions) {
final Collection<GuarantorFundingData> guarantorFundingDetails = null; final Collection<GuarantorFundingData> guarantorFundingDetails = null;
@@ -152,8 +146,8 @@ public class GuarantorData {
public static GuarantorData mergeClientData(final ClientData clientData, final GuarantorData guarantorData) { public static GuarantorData mergeClientData(final ClientData clientData, final GuarantorData guarantorData) {
return new GuarantorData(guarantorData.id, guarantorData.loanId, guarantorData.clientRelationshipType, guarantorData.entityId, return new GuarantorData(guarantorData.id, guarantorData.loanId, guarantorData.clientRelationshipType, guarantorData.entityId,
guarantorData.guarantorType, clientData.getFirstname(), clientData.getLastname(), null, null, null, null, null, null, null, guarantorData.guarantorType, clientData.getFirstname(), clientData.getLastname(), null, null, null, null, null, null, null,
null, null, null, clientData.officeName(), clientData.getActivationDate(), clientData.getExternalId(), guarantorData.status, null, null, null, clientData.getOfficeName(), clientData.getActivationDate(), clientData.getExternalId(),
guarantorData.guarantorFundingDetails, null, guarantorData.allowedClientRelationshipTypes, guarantorData.status, guarantorData.guarantorFundingDetails, null, guarantorData.allowedClientRelationshipTypes,
guarantorData.accountLinkingOptions); guarantorData.accountLinkingOptions);
} }
@@ -209,9 +203,4 @@ public class GuarantorData {
public boolean isStaffMember() { public boolean isStaffMember() {
return GuarantorType.STAFF.getValue().equals(this.guarantorType.getId().intValue()); return GuarantorType.STAFF.getValue().equals(this.guarantorType.getId().intValue());
} }
public Long getEntityId() {
return this.entityId;
}
} }
@@ -71,7 +71,7 @@ public class TransferFeeChargeForLoansTasklet implements Tasklet {
final boolean isExceptionForBalanceCheck = false; final boolean isExceptionForBalanceCheck = false;
final AccountTransferDTO accountTransferDTO = new AccountTransferDTO(DateUtils.getBusinessLocalDate(), final AccountTransferDTO accountTransferDTO = new AccountTransferDTO(DateUtils.getBusinessLocalDate(),
installmentChargeData.getAmountOutstanding(), PortfolioAccountType.SAVINGS, PortfolioAccountType.LOAN, installmentChargeData.getAmountOutstanding(), PortfolioAccountType.SAVINGS, PortfolioAccountType.LOAN,
portfolioAccountData.accountId(), chargeData.getLoanId(), "Loan Charge Payment", null, null, null, null, portfolioAccountData.getId(), chargeData.getLoanId(), "Loan Charge Payment", null, null, null, null,
LoanTransactionType.CHARGE_PAYMENT.getValue(), chargeData.getId(), LoanTransactionType.CHARGE_PAYMENT.getValue(), chargeData.getId(),
installmentChargeData.getInstallmentNumber(), AccountTransferType.CHARGE_PAYMENT.getValue(), null, null, installmentChargeData.getInstallmentNumber(), AccountTransferType.CHARGE_PAYMENT.getValue(), null, null,
null, null, null, null, isRegularTransaction, isExceptionForBalanceCheck); null, null, null, null, isRegularTransaction, isExceptionForBalanceCheck);
@@ -84,7 +84,7 @@ public class TransferFeeChargeForLoansTasklet implements Tasklet {
final boolean isExceptionForBalanceCheck = false; final boolean isExceptionForBalanceCheck = false;
final AccountTransferDTO accountTransferDTO = new AccountTransferDTO(DateUtils.getBusinessLocalDate(), final AccountTransferDTO accountTransferDTO = new AccountTransferDTO(DateUtils.getBusinessLocalDate(),
chargeData.getAmountOutstanding(), PortfolioAccountType.SAVINGS, PortfolioAccountType.LOAN, chargeData.getAmountOutstanding(), PortfolioAccountType.SAVINGS, PortfolioAccountType.LOAN,
portfolioAccountData.accountId(), chargeData.getLoanId(), "Loan Charge Payment", null, null, null, null, portfolioAccountData.getId(), chargeData.getLoanId(), "Loan Charge Payment", null, null, null, null,
LoanTransactionType.CHARGE_PAYMENT.getValue(), chargeData.getId(), null, LoanTransactionType.CHARGE_PAYMENT.getValue(), chargeData.getId(), null,
AccountTransferType.CHARGE_PAYMENT.getValue(), null, null, null, null, null, null, isRegularTransaction, AccountTransferType.CHARGE_PAYMENT.getValue(), null, null, null, null, null, null, isRegularTransaction,
isExceptionForBalanceCheck); isExceptionForBalanceCheck);
@@ -20,6 +20,7 @@ package org.apache.fineract.portfolio.loanaccount.loanschedule.data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Collection; import java.util.Collection;
import lombok.Getter;
import org.apache.fineract.organisation.monetary.data.CurrencyData; import org.apache.fineract.organisation.monetary.data.CurrencyData;
/** /**
@@ -31,7 +32,7 @@ import org.apache.fineract.organisation.monetary.data.CurrencyData;
* (both fees and penalties)</li> * (both fees and penalties)</li>
* </ul> * </ul>
*/ */
@SuppressWarnings("unused") @Getter
public class LoanScheduleData { public class LoanScheduleData {
/** /**
@@ -106,10 +107,6 @@ public class LoanScheduleData {
this.totalOutstanding = null; this.totalOutstanding = null;
} }
public Collection<LoanSchedulePeriodData> getPeriods() {
return this.periods;
}
public void updateFuturePeriods(Collection<LoanSchedulePeriodData> futurePeriods) { public void updateFuturePeriods(Collection<LoanSchedulePeriodData> futurePeriods) {
this.futurePeriods = futurePeriods; this.futurePeriods = futurePeriods;
} }
@@ -21,12 +21,14 @@ package org.apache.fineract.portfolio.loanaccount.loanschedule.data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import lombok.Getter;
import org.apache.fineract.infrastructure.core.service.DateUtils; import org.apache.fineract.infrastructure.core.service.DateUtils;
/** /**
* Immutable data object that represents a period of a loan schedule. * Immutable data object that represents a period of a loan schedule.
* *
*/ */
@Getter
public final class LoanSchedulePeriodData { public final class LoanSchedulePeriodData {
private final Integer period; private final Integer period;
@@ -42,7 +44,6 @@ public final class LoanSchedulePeriodData {
private final BigDecimal principalWrittenOff; private final BigDecimal principalWrittenOff;
private final BigDecimal principalOutstanding; private final BigDecimal principalOutstanding;
private final BigDecimal principalLoanBalanceOutstanding; private final BigDecimal principalLoanBalanceOutstanding;
@SuppressWarnings("unused")
private final BigDecimal interestOriginalDue; private final BigDecimal interestOriginalDue;
private final BigDecimal interestDue; private final BigDecimal interestDue;
private final BigDecimal interestPaid; private final BigDecimal interestPaid;
@@ -59,8 +60,6 @@ public final class LoanSchedulePeriodData {
private final BigDecimal penaltyChargesWaived; private final BigDecimal penaltyChargesWaived;
private final BigDecimal penaltyChargesWrittenOff; private final BigDecimal penaltyChargesWrittenOff;
private final BigDecimal penaltyChargesOutstanding; private final BigDecimal penaltyChargesOutstanding;
@SuppressWarnings("unused")
private final BigDecimal totalOriginalDueForPeriod; private final BigDecimal totalOriginalDueForPeriod;
private final BigDecimal totalDueForPeriod; private final BigDecimal totalDueForPeriod;
private final BigDecimal totalPaidForPeriod; private final BigDecimal totalPaidForPeriod;
@@ -341,111 +340,87 @@ public final class LoanSchedulePeriodData {
return value; return value;
} }
public Integer periodNumber() { public BigDecimal getPrincipalDisbursed() {
return this.period;
}
public LocalDate periodFromDate() {
return this.fromDate;
}
public LocalDate periodDueDate() {
return this.dueDate;
}
public Integer daysInPeriod() {
return this.daysInPeriod;
}
public BigDecimal principalDisbursed() {
return defaultToZeroIfNull(this.principalDisbursed); return defaultToZeroIfNull(this.principalDisbursed);
} }
public BigDecimal principalDue() { public BigDecimal getPrincipalDue() {
return defaultToZeroIfNull(this.principalDue); return defaultToZeroIfNull(this.principalDue);
} }
public BigDecimal principalPaid() { public BigDecimal getPrincipalPaid() {
return defaultToZeroIfNull(this.principalPaid); return defaultToZeroIfNull(this.principalPaid);
} }
public BigDecimal principalWrittenOff() { public BigDecimal getPrincipalWrittenOff() {
return defaultToZeroIfNull(this.principalWrittenOff); return defaultToZeroIfNull(this.principalWrittenOff);
} }
public BigDecimal principalOutstanding() { public BigDecimal getPrincipalOutstanding() {
return defaultToZeroIfNull(this.principalOutstanding); return defaultToZeroIfNull(this.principalOutstanding);
} }
public BigDecimal interestDue() { public BigDecimal getInterestDue() {
return defaultToZeroIfNull(this.interestDue); return defaultToZeroIfNull(this.interestDue);
} }
public BigDecimal interestPaid() { public BigDecimal getInterestPaid() {
return defaultToZeroIfNull(this.interestPaid); return defaultToZeroIfNull(this.interestPaid);
} }
public BigDecimal interestWaived() { public BigDecimal getInterestWaived() {
return defaultToZeroIfNull(this.interestWaived); return defaultToZeroIfNull(this.interestWaived);
} }
public BigDecimal interestWrittenOff() { public BigDecimal getInterestWrittenOff() {
return defaultToZeroIfNull(this.interestWrittenOff); return defaultToZeroIfNull(this.interestWrittenOff);
} }
public BigDecimal interestOutstanding() { public BigDecimal getInterestOutstanding() {
return defaultToZeroIfNull(this.interestOutstanding); return defaultToZeroIfNull(this.interestOutstanding);
} }
public BigDecimal feeChargesDue() { public BigDecimal getFeeChargesDue() {
return defaultToZeroIfNull(this.feeChargesDue); return defaultToZeroIfNull(this.feeChargesDue);
} }
public BigDecimal feeChargesWaived() { public BigDecimal getFeeChargesWaived() {
return defaultToZeroIfNull(this.feeChargesWaived); return defaultToZeroIfNull(this.feeChargesWaived);
} }
public BigDecimal feeChargesWrittenOff() { public BigDecimal getFeeChargesWrittenOff() {
return defaultToZeroIfNull(this.feeChargesWrittenOff); return defaultToZeroIfNull(this.feeChargesWrittenOff);
} }
public BigDecimal feeChargesPaid() { public BigDecimal getFeeChargesPaid() {
return defaultToZeroIfNull(this.feeChargesPaid); return defaultToZeroIfNull(this.feeChargesPaid);
} }
public BigDecimal feeChargesOutstanding() { public BigDecimal getFeeChargesOutstanding() {
return defaultToZeroIfNull(this.feeChargesOutstanding); return defaultToZeroIfNull(this.feeChargesOutstanding);
} }
public BigDecimal penaltyChargesDue() { public BigDecimal getPenaltyChargesDue() {
return defaultToZeroIfNull(this.penaltyChargesDue); return defaultToZeroIfNull(this.penaltyChargesDue);
} }
public BigDecimal penaltyChargesWaived() { public BigDecimal getPenaltyChargesWaived() {
return defaultToZeroIfNull(this.penaltyChargesWaived); return defaultToZeroIfNull(this.penaltyChargesWaived);
} }
public BigDecimal penaltyChargesWrittenOff() { public BigDecimal getPenaltyChargesWrittenOff() {
return defaultToZeroIfNull(this.penaltyChargesWrittenOff); return defaultToZeroIfNull(this.penaltyChargesWrittenOff);
} }
public BigDecimal penaltyChargesPaid() { public BigDecimal getPenaltyChargesPaid() {
return defaultToZeroIfNull(this.penaltyChargesPaid); return defaultToZeroIfNull(this.penaltyChargesPaid);
} }
public BigDecimal penaltyChargesOutstanding() { public BigDecimal getPenaltyChargesOutstanding() {
return defaultToZeroIfNull(this.penaltyChargesOutstanding); return defaultToZeroIfNull(this.penaltyChargesOutstanding);
} }
public BigDecimal totalOverdue() { public BigDecimal getTotalOverdue() {
return defaultToZeroIfNull(this.totalOverdue); return defaultToZeroIfNull(this.totalOverdue);
} }
public BigDecimal principalLoanBalanceOutstanding() {
return this.principalLoanBalanceOutstanding;
}
public Boolean getComplete() {
return this.complete;
}
} }
@@ -1005,7 +1005,7 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
// due date changes should be applied only for that dueDate // due date changes should be applied only for that dueDate
if (loanApplicationTerms.getLoanTermVariations().hasDueDateVariation(scheduledDueDate)) { if (loanApplicationTerms.getLoanTermVariations().hasDueDateVariation(scheduledDueDate)) {
LoanTermVariationsData loanTermVariationsData = loanApplicationTerms.getLoanTermVariations().nextDueDateVariation(); LoanTermVariationsData loanTermVariationsData = loanApplicationTerms.getLoanTermVariations().nextDueDateVariation();
if (loanTermVariationsData.getTermApplicableFrom().isEqual(modifiedScheduledDueDate)) { if (loanTermVariationsData.getTermVariationApplicableFrom().isEqual(modifiedScheduledDueDate)) {
modifiedScheduledDueDate = loanTermVariationsData.getDateValue(); modifiedScheduledDueDate = loanTermVariationsData.getDateValue();
if (!loanTermVariationsData.isSpecificToInstallment()) { if (!loanTermVariationsData.isSpecificToInstallment()) {
scheduleParams.setActualRepaymentDate(modifiedScheduledDueDate); scheduleParams.setActualRepaymentDate(modifiedScheduledDueDate);
@@ -1044,7 +1044,7 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
switch (loanTermVariationsData.getTermVariationType()) { switch (loanTermVariationsData.getTermVariationType()) {
case INSERT_INSTALLMENT: case INSERT_INSTALLMENT:
scheduleParams.setActualRepaymentDate(previousRepaymentDate); scheduleParams.setActualRepaymentDate(previousRepaymentDate);
modifiedScheduledDueDate = loanTermVariationsData.getTermApplicableFrom(); modifiedScheduledDueDate = loanTermVariationsData.getTermVariationApplicableFrom();
if (loanTermVariationsData.getDecimalValue() != null) { if (loanTermVariationsData.getDecimalValue() != null) {
if (loanApplicationTerms.getInterestMethod().isDecliningBalance() if (loanApplicationTerms.getInterestMethod().isDecliningBalance()
&& loanApplicationTerms.getAmortizationMethod().isEqualInstallment()) { && loanApplicationTerms.getAmortizationMethod().isEqualInstallment()) {
@@ -1057,7 +1057,7 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
loanTermVariationsData.setProcessed(true); loanTermVariationsData.setProcessed(true);
break; break;
case DELETE_INSTALLMENT: case DELETE_INSTALLMENT:
if (loanTermVariationsData.getTermApplicableFrom().isEqual(modifiedScheduledDueDate)) { if (loanTermVariationsData.getTermVariationApplicableFrom().isEqual(modifiedScheduledDueDate)) {
skipPeriod = true; skipPeriod = true;
loanTermVariationsData.setProcessed(true); loanTermVariationsData.setProcessed(true);
} }
@@ -1161,11 +1161,11 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
} }
switch (loanTermVariationsData.getTermVariationType()) { switch (loanTermVariationsData.getTermVariationType()) {
case INSERT_INSTALLMENT: case INSERT_INSTALLMENT:
modifiedScheduledDueDate = loanTermVariationsData.getTermApplicableFrom(); modifiedScheduledDueDate = loanTermVariationsData.getTermVariationApplicableFrom();
variationsData.add(loanTermVariationsData); variationsData.add(loanTermVariationsData);
break; break;
case DELETE_INSTALLMENT: case DELETE_INSTALLMENT:
if (loanTermVariationsData.getTermApplicableFrom().isEqual(modifiedScheduledDueDate)) { if (loanTermVariationsData.getTermVariationApplicableFrom().isEqual(modifiedScheduledDueDate)) {
skipPeriod = true; skipPeriod = true;
variationsData.add(loanTermVariationsData); variationsData.add(loanTermVariationsData);
} }
@@ -1922,10 +1922,10 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
for (DisbursementData disbursementData : loanApplicationTerms.getDisbursementDatas()) { for (DisbursementData disbursementData : loanApplicationTerms.getDisbursementDatas()) {
if (disbursementData.disbursementDate().equals(disbursementDate)) { if (disbursementData.disbursementDate().equals(disbursementDate)) {
final LoanScheduleModelDisbursementPeriod disbursementPeriod = LoanScheduleModelDisbursementPeriod.disbursement( final LoanScheduleModelDisbursementPeriod disbursementPeriod = LoanScheduleModelDisbursementPeriod.disbursement(
disbursementData.disbursementDate(), Money.of(currency, disbursementData.amount()), disbursementData.disbursementDate(), Money.of(currency, disbursementData.getPrincipal()),
chargesDueAtTimeOfDisbursement); chargesDueAtTimeOfDisbursement);
periods.add(disbursementPeriod); periods.add(disbursementPeriod);
principal = principal.add(disbursementData.amount()); principal = principal.add(disbursementData.getPrincipal());
} else if (!excludePastUndisbursed || disbursementData.isDisbursed() } else if (!excludePastUndisbursed || disbursementData.isDisbursed()
|| !disbursementData.disbursementDate().isBefore(DateUtils.getLocalDateOfTenant())) { || !disbursementData.disbursementDate().isBefore(DateUtils.getLocalDateOfTenant())) {
/* /*
@@ -1937,7 +1937,7 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
if (prevsum != null) { if (prevsum != null) {
sumToNow = prevsum.getAmount(); sumToNow = prevsum.getAmount();
} }
sumToNow = sumToNow.add(disbursementData.amount()); sumToNow = sumToNow.add(disbursementData.getPrincipal());
disurseDetail.put(disbursementData.disbursementDate(), Money.of(currency, sumToNow)); disurseDetail.put(disbursementData.disbursementDate(), Money.of(currency, sumToNow));
} }
} }
@@ -74,7 +74,7 @@ public class DecliningBalanceInterestLoanScheduleGenerator extends AbstractLoanS
for (LoanTermVariationsData loanTermVariation : termVariations) { for (LoanTermVariationsData loanTermVariation : termVariations) {
if (loanTermVariation.getTermVariationType().isInterestRateVariation() if (loanTermVariation.getTermVariationType().isInterestRateVariation()
&& loanTermVariation.isApplicable(periodStartDate, periodEndDate)) { && loanTermVariation.isApplicable(periodStartDate, periodEndDate)) {
LocalDate fromDate = loanTermVariation.getTermApplicableFrom(); LocalDate fromDate = loanTermVariation.getTermVariationApplicableFrom();
if (fromDate == null) { if (fromDate == null) {
fromDate = periodStartDate; fromDate = periodStartDate;
} }
@@ -1693,7 +1693,7 @@ public final class LoanApplicationTerms {
if (isMultiDisburseLoan()) { if (isMultiDisburseLoan()) {
for (DisbursementData disbursement : getDisbursementDatas()) { for (DisbursementData disbursement : getDisbursementDatas()) {
if (disbursement.isDisbursed()) { if (disbursement.isDisbursed()) {
disbursedAmount = disbursedAmount.plus(disbursement.amount()); disbursedAmount = disbursedAmount.plus(disbursement.getPrincipal());
} }
} }
} else { } else {

Some files were not shown because too many files have changed in this diff Show More