update DDL and reference data files and also demo dumps with latest schema and core reports work.
This commit is contained in:
+2
-2
@@ -27,13 +27,13 @@ public class LoanChargeCommand implements Comparable<LoanChargeCommand> {
|
||||
private final LocalDate dueDate;
|
||||
|
||||
public LoanChargeCommand(final Long id, final Long chargeId, final BigDecimal amount, final Integer chargeTimeType,
|
||||
final Integer chargeCalculationType, final LocalDate specifiedDueDate) {
|
||||
final Integer chargeCalculationType, final LocalDate dueDate) {
|
||||
this.id = id;
|
||||
this.chargeId = chargeId;
|
||||
this.amount = amount;
|
||||
this.chargeTimeType = chargeTimeType;
|
||||
this.chargeCalculationType = chargeCalculationType;
|
||||
this.dueDate = specifiedDueDate;
|
||||
this.dueDate = dueDate;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+13
-13
@@ -241,9 +241,9 @@ public class LoanCharge extends AbstractPersistable<Long> {
|
||||
this.loan = loan;
|
||||
}
|
||||
|
||||
public void update(final BigDecimal amount, final LocalDate specifiedDueDate, final BigDecimal loanPrincipal) {
|
||||
if (specifiedDueDate != null) {
|
||||
this.dueDate = specifiedDueDate.toDate();
|
||||
public void update(final BigDecimal amount, final LocalDate dueDate, final BigDecimal loanPrincipal) {
|
||||
if (dueDate != null) {
|
||||
this.dueDate = dueDate.toDate();
|
||||
}
|
||||
|
||||
if (amount != null) {
|
||||
@@ -304,14 +304,14 @@ public class LoanCharge extends AbstractPersistable<Long> {
|
||||
// ChargeCalculationType.fromInt(newValue).getValue();
|
||||
// }
|
||||
|
||||
final String specifiedDueDateParamName = "dueDate";
|
||||
if (command.isChangeInLocalDateParameterNamed(specifiedDueDateParamName, getDueLocalDate())) {
|
||||
final String valueAsInput = command.stringValueOfParameterNamed(specifiedDueDateParamName);
|
||||
actualChanges.put(specifiedDueDateParamName, valueAsInput);
|
||||
final String dueDateParamName = "dueDate";
|
||||
if (command.isChangeInLocalDateParameterNamed(dueDateParamName, getDueLocalDate())) {
|
||||
final String valueAsInput = command.stringValueOfParameterNamed(dueDateParamName);
|
||||
actualChanges.put(dueDateParamName, valueAsInput);
|
||||
actualChanges.put("dateFormat", dateFormatAsInput);
|
||||
actualChanges.put("locale", localeAsInput);
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(specifiedDueDateParamName);
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(dueDateParamName);
|
||||
this.dueDate = newValue.toDate();
|
||||
}
|
||||
|
||||
@@ -368,11 +368,11 @@ public class LoanCharge extends AbstractPersistable<Long> {
|
||||
}
|
||||
|
||||
public LocalDate getDueLocalDate() {
|
||||
LocalDate specifiedDueDate = null;
|
||||
LocalDate dueDate = null;
|
||||
if (this.dueDate != null) {
|
||||
specifiedDueDate = new LocalDate(this.dueDate);
|
||||
dueDate = new LocalDate(this.dueDate);
|
||||
}
|
||||
return specifiedDueDate;
|
||||
return dueDate;
|
||||
}
|
||||
|
||||
private boolean determineIfFullyPaid() {
|
||||
@@ -427,8 +427,8 @@ public class LoanCharge extends AbstractPersistable<Long> {
|
||||
}
|
||||
|
||||
public boolean isDueForCollectionFromAndUpToAndIncluding(final LocalDate fromNotInclusive, final LocalDate upToAndInclusive) {
|
||||
final LocalDate specifiedDueDate = getDueLocalDate();
|
||||
return occursOnDayFromAndUpToAndIncluding(fromNotInclusive, upToAndInclusive, specifiedDueDate);
|
||||
final LocalDate dueDate = getDueLocalDate();
|
||||
return occursOnDayFromAndUpToAndIncluding(fromNotInclusive, upToAndInclusive, dueDate);
|
||||
}
|
||||
|
||||
private boolean occursOnDayFromAndUpToAndIncluding(final LocalDate fromNotInclusive, final LocalDate upToAndInclusive,
|
||||
|
||||
+2
-46
@@ -156,7 +156,7 @@ public final class CalculateLoanScheduleQueryFromApiJsonHelper {
|
||||
if (topLevelJsonElement.get(chargesParameterName).isJsonArray()) {
|
||||
final Type arrayObjectParameterTypeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
final Set<String> supportedParameters = new HashSet<String>(Arrays.asList("id", "chargeId", "amount", "chargeTimeType",
|
||||
"chargeCalculationType", "specifiedDueDate"));
|
||||
"chargeCalculationType", "dueDate"));
|
||||
|
||||
final JsonArray array = topLevelJsonElement.get("charges").getAsJsonArray();
|
||||
for (int i = 1; i <= array.size(); i++) {
|
||||
@@ -173,7 +173,7 @@ public final class CalculateLoanScheduleQueryFromApiJsonHelper {
|
||||
baseDataValidator.reset().parameter("charges").parameterAtIndexArray("amount", i).value(amount).notNull()
|
||||
.positiveAmount();
|
||||
|
||||
fromApiJsonHelper.extractLocalDateNamed("specifiedDueDate", loanChargeElement, dateFormat, locale);
|
||||
fromApiJsonHelper.extractLocalDateNamed("dueDate", loanChargeElement, dateFormat, locale);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -239,48 +239,4 @@ public final class CalculateLoanScheduleQueryFromApiJsonHelper {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// private LoanChargeCommand[] extractInToLoanChargeCommands(final
|
||||
// JsonElement element) {
|
||||
// LoanChargeCommand[] charges = null;
|
||||
// if (element.isJsonObject()) {
|
||||
// final JsonObject topLevelJsonElement = element.getAsJsonObject();
|
||||
// final String dateFormat =
|
||||
// fromApiJsonHelper.extractDateFormatParameter(topLevelJsonElement);
|
||||
// final Locale locale =
|
||||
// fromApiJsonHelper.extractLocaleParameter(topLevelJsonElement);
|
||||
// if (topLevelJsonElement.has("charges") &&
|
||||
// topLevelJsonElement.get("charges").isJsonArray()) {
|
||||
//
|
||||
// final JsonArray array =
|
||||
// topLevelJsonElement.get("charges").getAsJsonArray();
|
||||
// charges = new LoanChargeCommand[array.size()];
|
||||
// for (int i = 0; i < array.size(); i++) {
|
||||
//
|
||||
// final JsonObject loanChargeElement = array.get(i).getAsJsonObject();
|
||||
//
|
||||
// final Long id = fromApiJsonHelper.extractLongNamed("id",
|
||||
// loanChargeElement);
|
||||
// final Long chargeId = fromApiJsonHelper.extractLongNamed("chargeId",
|
||||
// loanChargeElement);
|
||||
// final BigDecimal amount =
|
||||
// fromApiJsonHelper.extractBigDecimalNamed("amount", loanChargeElement,
|
||||
// locale);
|
||||
// final Integer chargeTimeType =
|
||||
// fromApiJsonHelper.extractIntegerNamed("chargeTimeType",
|
||||
// loanChargeElement, locale);
|
||||
// final Integer chargeCalculationType =
|
||||
// fromApiJsonHelper.extractIntegerNamed("chargeCalculationType",
|
||||
// loanChargeElement,
|
||||
// locale);
|
||||
// fromApiJsonHelper.extractLocalDateNamed("specifiedDueDate",
|
||||
// loanChargeElement, dateFormat, locale);
|
||||
//
|
||||
// charges[i] = new LoanChargeCommand(id, chargeId, amount, chargeTimeType,
|
||||
// chargeCalculationType);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return charges;
|
||||
// }
|
||||
}
|
||||
+4
-4
@@ -217,7 +217,7 @@ public final class LoanApplicationCommandFromApiJsonHelper {
|
||||
if (topLevelJsonElement.get(chargesParameterName).isJsonArray()) {
|
||||
final Type arrayObjectParameterTypeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
final Set<String> supportedParameters = new HashSet<String>(Arrays.asList("id", "chargeId", "amount", "chargeTimeType",
|
||||
"chargeCalculationType", "specifiedDueDate"));
|
||||
"chargeCalculationType", "dueDate"));
|
||||
|
||||
final JsonArray array = topLevelJsonElement.get("charges").getAsJsonArray();
|
||||
for (int i = 1; i <= array.size(); i++) {
|
||||
@@ -234,7 +234,7 @@ public final class LoanApplicationCommandFromApiJsonHelper {
|
||||
baseDataValidator.reset().parameter("charges").parameterAtIndexArray("amount", i).value(amount).notNull()
|
||||
.positiveAmount();
|
||||
|
||||
fromApiJsonHelper.extractLocalDateNamed("specifiedDueDate", loanChargeElement, dateFormat, locale);
|
||||
fromApiJsonHelper.extractLocalDateNamed("dueDate", loanChargeElement, dateFormat, locale);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -488,7 +488,7 @@ public final class LoanApplicationCommandFromApiJsonHelper {
|
||||
if (topLevelJsonElement.get(chargesParameterName).isJsonArray()) {
|
||||
final Type arrayObjectParameterTypeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
final Set<String> supportedParameters = new HashSet<String>(Arrays.asList("id", "chargeId", "amount", "chargeTimeType",
|
||||
"chargeCalculationType", "specifiedDueDate"));
|
||||
"chargeCalculationType", "dueDate"));
|
||||
|
||||
final JsonArray array = topLevelJsonElement.get("charges").getAsJsonArray();
|
||||
for (int i = 1; i <= array.size(); i++) {
|
||||
@@ -505,7 +505,7 @@ public final class LoanApplicationCommandFromApiJsonHelper {
|
||||
baseDataValidator.reset().parameter("charges").parameterAtIndexArray("amount", i).value(amount).notNull()
|
||||
.positiveAmount();
|
||||
|
||||
fromApiJsonHelper.extractLocalDateNamed("specifiedDueDate", loanChargeElement, dateFormat, locale);
|
||||
fromApiJsonHelper.extractLocalDateNamed("dueDate", loanChargeElement, dateFormat, locale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -63,7 +63,7 @@ public class LoanChargeAssembler {
|
||||
final Integer chargeTimeType = fromApiJsonHelper.extractIntegerNamed("chargeTimeType", loanChargeElement, locale);
|
||||
final Integer chargeCalculationType = fromApiJsonHelper.extractIntegerNamed("chargeCalculationType", loanChargeElement,
|
||||
locale);
|
||||
final LocalDate specifiedDueDate = fromApiJsonHelper.extractLocalDateNamed("specifiedDueDate", loanChargeElement,
|
||||
final LocalDate dueDate = fromApiJsonHelper.extractLocalDateNamed("dueDate", loanChargeElement,
|
||||
dateFormat, locale);
|
||||
|
||||
if (id == null) {
|
||||
@@ -77,14 +77,14 @@ public class LoanChargeAssembler {
|
||||
ChargeCalculationType.fromInt(chargeCalculationType);
|
||||
}
|
||||
final LoanCharge loanCharge = LoanCharge.createNewWithoutLoan(chargeDefinition, principal, amount, chargeTime,
|
||||
chargeCalculation, specifiedDueDate);
|
||||
chargeCalculation, dueDate);
|
||||
loanCharges.add(loanCharge);
|
||||
} else {
|
||||
final Long loanChargeId = id;
|
||||
final LoanCharge loanCharge = this.loanChargeRepository.findOne(loanChargeId);
|
||||
if (loanCharge == null) { throw new LoanChargeNotFoundException(loanChargeId); }
|
||||
|
||||
loanCharge.update(amount, specifiedDueDate, principal);
|
||||
loanCharge.update(amount, dueDate, principal);
|
||||
|
||||
loanCharges.add(loanCharge);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user