corrected type while fethcing data from metadata

This commit is contained in:
pramod
2016-02-16 12:21:30 +05:30
parent a13a80794f
commit b5dc6b2b5b
2 changed files with 79 additions and 62 deletions
@@ -68,20 +68,8 @@ public final class ResultsetColumnHeaderData {
this.columnValues = columnValues; this.columnValues = columnValues;
this.columnCode = columnCode; this.columnCode = columnCode;
if("NEWDECIMAL".equalsIgnoreCase(this.columnType)) {
this.columnType = "DECIMAL" ;
// Refer org.drizzle.jdbc.internal.mysql.MySQLType.java // Refer org.drizzle.jdbc.internal.mysql.MySQLType.java
} adjustColumnTypes();
if("CLOB".equalsIgnoreCase(this.columnType)) {
this.columnType = "varchar" ;
//Drizzle is returning some of the String data a CLOB
}
if("LONGLONG".equalsIgnoreCase(this.columnType) || "LONG".equalsIgnoreCase(this.columnType)) {
this.columnType = "bigint" ;
//Refer org.drizzle.jdbc.internal.mysql.MySQLType.java
}
String displayType = null; String displayType = null;
if (this.columnCode == null) { if (this.columnCode == null) {
@@ -118,6 +106,33 @@ public final class ResultsetColumnHeaderData {
this.columnDisplayType = displayType; this.columnDisplayType = displayType;
} }
private void adjustColumnTypes() {
switch (this.columnType) {
case "NEWDECIMAL":
this.columnType = "DECIMAL";
break;
case "CLOB":
case "ENUM":
case "SET":
this.columnType = "varchar";
break;
case "LONGLONG":
this.columnType = "bigint";
break;
case "SHORT":
this.columnType = "smallint";
break;
case "TINY":
this.columnType = "tinyint";
break;
case "INT24":
this.columnType = "int";
break;
default:
break;
}
}
public boolean isNamed(final String columnName) { public boolean isNamed(final String columnName) {
return this.columnName.equalsIgnoreCase(columnName); return this.columnName.equalsIgnoreCase(columnName);
} }
@@ -2337,7 +2337,8 @@ public class Loan extends AbstractPersistable<Long> {
} }
public void regenerateScheduleOnDisbursement(final ScheduleGeneratorDTO scheduleGeneratorDTO, final boolean recalculateSchedule, public void regenerateScheduleOnDisbursement(final ScheduleGeneratorDTO scheduleGeneratorDTO, final boolean recalculateSchedule,
final LocalDate actualDisbursementDate, BigDecimal emiAmount, final AppUser currentUser, LocalDate nextPossibleRepaymentDate, Date rescheduledRepaymentDate) { final LocalDate actualDisbursementDate, BigDecimal emiAmount, final AppUser currentUser, LocalDate nextPossibleRepaymentDate,
Date rescheduledRepaymentDate) {
boolean isEmiAmountChanged = false; boolean isEmiAmountChanged = false;
if ((this.loanProduct.isMultiDisburseLoan() || this.loanProduct.canDefineInstallmentAmount()) && emiAmount != null if ((this.loanProduct.isMultiDisburseLoan() || this.loanProduct.canDefineInstallmentAmount()) && emiAmount != null
&& emiAmount.compareTo(retriveLastEmiAmount()) != 0) { && emiAmount.compareTo(retriveLastEmiAmount()) != 0) {
@@ -2355,7 +2356,8 @@ public class Loan extends AbstractPersistable<Long> {
if (rescheduledRepaymentDate != null && this.loanProduct.isMultiDisburseLoan()) { if (rescheduledRepaymentDate != null && this.loanProduct.isMultiDisburseLoan()) {
final boolean isSpecificToInstallment = false; final boolean isSpecificToInstallment = false;
LoanTermVariations loanVariationTerms = new LoanTermVariations(LoanTermVariationType.DUE_DATE.getValue(), LoanTermVariations loanVariationTerms = new LoanTermVariations(LoanTermVariationType.DUE_DATE.getValue(),
nextPossibleRepaymentDate.toDate(), emiAmount, rescheduledRepaymentDate, isSpecificToInstallment, this, LoanStatus.ACTIVE.getValue()); nextPossibleRepaymentDate.toDate(), emiAmount, rescheduledRepaymentDate, isSpecificToInstallment, this,
LoanStatus.ACTIVE.getValue());
this.loanTermVariations.add(loanVariationTerms); this.loanTermVariations.add(loanVariationTerms);
} }
@@ -4965,8 +4967,8 @@ public class Loan extends AbstractPersistable<Long> {
for (LoanTransaction loanTransaction : allNonContraTransactionsPostDisbursement) { for (LoanTransaction loanTransaction : allNonContraTransactionsPostDisbursement) {
copyTransactions.add(LoanTransaction.copyTransactionProperties(loanTransaction)); copyTransactions.add(LoanTransaction.copyTransactionProperties(loanTransaction));
} }
loanRepaymentScheduleTransactionProcessor.handleTransaction(getDisbursementDate(), copyTransactions, loanRepaymentScheduleTransactionProcessor.handleTransaction(getDisbursementDate(), copyTransactions, getCurrency(),
getCurrency(), this.repaymentScheduleInstallments, charges()); this.repaymentScheduleInstallments, charges());
updateLoanSummaryDerivedFields(); updateLoanSummaryDerivedFields();
} }
@@ -5663,8 +5665,8 @@ public class Loan extends AbstractPersistable<Long> {
for (LoanDisbursementDetails loanDisbursementDetail : loanDisbursementDetails) { for (LoanDisbursementDetails loanDisbursementDetail : loanDisbursementDetails) {
if (loanDisbursementDetail.actualDisbursementDate() == null) { if (loanDisbursementDetail.actualDisbursementDate() == null) {
for (final LoanRepaymentScheduleInstallment installment : this.repaymentScheduleInstallments) { for (final LoanRepaymentScheduleInstallment installment : this.repaymentScheduleInstallments) {
if (installment.getDueDate().isEqual(loanDisbursementDetail.expectedDisbursementDateAsLocalDate()) || if (installment.getDueDate().isEqual(loanDisbursementDetail.expectedDisbursementDateAsLocalDate())
installment.getDueDate().isAfter(loanDisbursementDetail.expectedDisbursementDateAsLocalDate()) || installment.getDueDate().isAfter(loanDisbursementDetail.expectedDisbursementDateAsLocalDate())
&& installment.isNotFullyPaidOff()) { && installment.isNotFullyPaidOff()) {
nextRepaymentDate = installment.getDueDate(); nextRepaymentDate = installment.getDueDate();
break; break;