Skip to content

Commit

Permalink
Merge branch 'develop' into mysql-5.7
Browse files Browse the repository at this point in the history
  • Loading branch information
conradsp authored Oct 3, 2018
2 parents 7832e66 + b5213c0 commit add8795
Show file tree
Hide file tree
Showing 12 changed files with 297 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ public void testClientImport() throws InterruptedException, IOException, ParseEx
firstClientRow.createCell(ClientEntityConstants.SUBMITTED_ON_COL).setCellValue(submittedDate);
firstClientRow.createCell(ClientEntityConstants.ADDRESS_ENABLED).setCellValue("False");

File directory=new File(System.getProperty("user.home")+"\\Fineract\\bulkimport\\integration_tests\\importhandler\\client") ;
File directory=new File(System.getProperty("user.home")+File.separator+"Fineract"+File.separator+"bulkimport"+File.separator+"integration_tests"+File.separator+"importhandler"+File.separator+"client") ;
if (!directory.exists())
directory.mkdirs();
File file= new File(directory+"\\ClientEntity.xls");
File file= new File(directory+File.separator+"ClientEntity.xls");
OutputStream outputStream=new FileOutputStream(file);
workbook.write(outputStream);
outputStream.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,27 +80,28 @@ public void testLoanImport() throws InterruptedException, IOException, ParseExce
Integer outcome_staff_creation =staffHelper.createStaff(requestSpec,responseSpec);
Assert.assertNotNull("Could not create staff",outcome_staff_creation);

LoanTransactionHelper loanTransactionHelper=new LoanTransactionHelper(requestSpec,responseSpec);
LoanProductTestBuilder loanProductTestBuilder=new LoanProductTestBuilder();
String jsonLoanProduct=loanProductTestBuilder.build(null);
Integer outcome_lp_creaion=loanTransactionHelper.getLoanProductId(jsonLoanProduct);
Assert.assertNotNull("Could not create Loan Product" ,outcome_lp_creaion);

FundsResourceHandler fundsResourceHandler=new FundsResourceHandler();
String jsonFund="{\n" +
"\t\"name\": \""+Utils.randomNameGenerator("Fund_Name",9)+"\"\n" +
"}";
Integer outcome_fund_creation=fundsResourceHandler.createFund(jsonFund,requestSpec,responseSpec);
Assert.assertNotNull("Could not create Fund" ,outcome_fund_creation);

PaymentTypeHelper paymentTypeHelper=new PaymentTypeHelper();
String name = PaymentTypeHelper.randomNameGenerator("P_T", 5);
String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15);
Boolean isCashPayment = true;
Integer position = 1;
Integer outcome_payment_creation= paymentTypeHelper.createPaymentType(requestSpec, responseSpec,name,description,isCashPayment,position);
Assert.assertNotNull("Could not create payment type" ,outcome_payment_creation);
// LoanTransactionHelper ltHelper=new LoanTransactionHelper(requestSpec,responseSpec);
// LoanProductTestBuilder loanProductTestBuilder=new LoanProductTestBuilder();
// String jsonLoanProduct=loanProductTestBuilder.build(null);
// Integer outcome_lp_creaion=ltHelper.getLoanProductId(jsonLoanProduct);
// Assert.assertNotNull("Could not create Loan Product" ,outcome_lp_creaion);

// FundsResourceHandler fundsResourceHandler=new FundsResourceHandler();
// String jsonFund="{\n" +
// "\t\"name\": \""+Utils.randomNameGenerator("Fund_Name",9)+"\"\n" +
// "}";
// Integer outcome_fund_creation=fundsResourceHandler.createFund(jsonFund,requestSpec,responseSpec);
// Assert.assertNotNull("Could not create Fund" ,outcome_fund_creation);

// PaymentTypeHelper paymentTypeHelper=new PaymentTypeHelper();
// String name = PaymentTypeHelper.randomNameGenerator("P_T", 5);
// String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15);
// Boolean isCashPayment = true;
// Integer position = 1;
// Integer outcome_payment_creation= paymentTypeHelper.createPaymentType(requestSpec, responseSpec,name,description,isCashPayment,position);
// Assert.assertNotNull("Could not create payment type" ,outcome_payment_creation);

LoanTransactionHelper loanTransactionHelper=new LoanTransactionHelper(requestSpec,responseSpec);
Workbook workbook=loanTransactionHelper.getLoanWorkbook("dd MMMM yyyy");

//insert dummy data into loan Sheet
Expand All @@ -127,7 +128,7 @@ public void testLoanImport() throws InterruptedException, IOException, ParseExce
firstLoanRow.createCell(LoanConstants.NO_OF_REPAYMENTS_COL).setCellValue(loanProductSheet.getRow(1).getCell(6).getNumericCellValue());
firstLoanRow.createCell(LoanConstants.REPAID_EVERY_COL).setCellValue(loanProductSheet.getRow(1).getCell(9).getNumericCellValue());
firstLoanRow.createCell(LoanConstants.REPAID_EVERY_FREQUENCY_COL).setCellValue(loanProductSheet.getRow(1).getCell(10).getStringCellValue());
firstLoanRow.createCell(LoanConstants.LOAN_TERM_COL).setCellValue(loanProductSheet.getRow(1).getCell(8).getNumericCellValue());
firstLoanRow.createCell(LoanConstants.LOAN_TERM_COL).setCellValue(60);
firstLoanRow.createCell(LoanConstants.LOAN_TERM_FREQUENCY_COL).setCellValue(loanProductSheet.getRow(1).getCell(10).getStringCellValue());
firstLoanRow.createCell(LoanConstants.NOMINAL_INTEREST_RATE_COL).setCellValue(loanProductSheet.getRow(1).getCell(11).getNumericCellValue());
firstLoanRow.createCell(LoanConstants.NOMINAL_INTEREST_RATE_FREQUENCY_COL).setCellValue(loanProductSheet.getRow(1).getCell(14).getStringCellValue());
Expand All @@ -144,10 +145,12 @@ public void testLoanImport() throws InterruptedException, IOException, ParseExce
firstLoanRow.createCell(LoanConstants.LAST_REPAYMENT_DATE_COL).setCellValue(date);
firstLoanRow.createCell(LoanConstants.REPAYMENT_TYPE_COL).setCellValue(extrasSheet.getRow(1).getCell(3).getStringCellValue());

File directory=new File(System.getProperty("user.home")+"\\Fineract\\bulkimport\\integration_tests\\importhandler\\loan") ;
String currentdirectory = new File("").getAbsolutePath();
File directory=new File(currentdirectory+File.separator+"src"+File.separator+"integrationTest"+File.separator+
"resources"+File.separator+"bulkimport"+File.separator+"importhandler"+File.separator+"loan") ;
if (!directory.exists())
directory.mkdirs();
File file= new File(directory+"\\Loan.xls");
File file= new File(directory+File.separator+"Loan.xls");
OutputStream outputStream=new FileOutputStream(file);
workbook.write(outputStream);
outputStream.close();
Expand All @@ -157,7 +160,7 @@ public void testLoanImport() throws InterruptedException, IOException, ParseExce
Assert.assertNotNull(importDocumentId);

//Wait for the creation of output excel
Thread.sleep(3000);
Thread.sleep(10000);

//check status column of output excel
String location=loanTransactionHelper.getOutputTemplateLocation(importDocumentId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ public void testOfficeImport() throws IOException, InterruptedException, NoSuchF
firstOfficeRow.createCell(OfficeConstants.OPENED_ON_COL).setCellValue(date);

String currentdirectory = new File("").getAbsolutePath();
File directory=new File(currentdirectory+"\\src\\integrationTest\\" +
"resources\\bulkimport\\importhandler\\office");
File directory=new File(currentdirectory+File.separator+"src"+File.separator+"integrationTest"+File.separator+
"resources"+File.separator+"bulkimport"+File.separator+"importhandler"+File.separator+"office");
if (!directory.exists())
directory.mkdirs();
File file= new File(directory+"\\Office.xls");
File file= new File(directory+File.separator+"Office.xls");
OutputStream outputStream=new FileOutputStream(file);
workbook.write(outputStream);
outputStream.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,19 @@ public void testSavingsImport() throws InterruptedException, IOException, ParseE
firstSavingsRow.createCell(SavingsConstants.INTEREST_POSTING_PERIOD_COL).setCellValue(savingsProductSheet.getRow(1).getCell(4).getStringCellValue());
firstSavingsRow.createCell(SavingsConstants.INTEREST_CALCULATION_COL).setCellValue(savingsProductSheet.getRow(1).getCell(5).getStringCellValue());
firstSavingsRow.createCell(SavingsConstants.INTEREST_CALCULATION_DAYS_IN_YEAR_COL).setCellValue(savingsProductSheet.getRow(1).getCell(6).getStringCellValue());
firstSavingsRow.createCell(SavingsConstants.MIN_OPENING_BALANCE_COL).setCellValue(savingsProductSheet.getRow(1).getCell(7).getNumericCellValue());
firstSavingsRow.createCell(SavingsConstants.LOCKIN_PERIOD_COL).setCellValue(savingsProductSheet.getRow(1).getCell(8).getNumericCellValue());
firstSavingsRow.createCell(SavingsConstants.LOCKIN_PERIOD_FREQUENCY_COL).setCellValue(savingsProductSheet.getRow(1).getCell(9).getStringCellValue());
firstSavingsRow.createCell(SavingsConstants.MIN_OPENING_BALANCE_COL).setCellValue(1000.0);
firstSavingsRow.createCell(SavingsConstants.LOCKIN_PERIOD_COL).setCellValue(1);
firstSavingsRow.createCell(SavingsConstants.LOCKIN_PERIOD_FREQUENCY_COL).setCellValue("Weeks");
firstSavingsRow.createCell(SavingsConstants.APPLY_WITHDRAWAL_FEE_FOR_TRANSFERS).setCellValue("False");
firstSavingsRow.createCell(SavingsConstants.ALLOW_OVER_DRAFT_COL).setCellValue("False");
firstSavingsRow.createCell(SavingsConstants.OVER_DRAFT_LIMIT_COL).setCellValue(savingsProductSheet.getRow(1).getCell(15).getNumericCellValue());

File directory=new File(System.getProperty("user.home")+"\\Fineract\\bulkimport\\integration_tests\\importhandler\\savings") ;
String currentdirectory = new File("").getAbsolutePath();
File directory=new File(currentdirectory+File.separator+"src"+File.separator+"integrationTest"+File.separator+
"resources"+File.separator+"bulkimport"+File.separator+"importhandler"+File.separator+"savings") ;
if (!directory.exists())
directory.mkdirs();
File file= new File(directory+"\\Savings.xls");
File file= new File(directory+File.separator+"Savings.xls");
OutputStream outputStream=new FileOutputStream(file);
workbook.write(outputStream);
outputStream.close();
Expand All @@ -138,7 +140,7 @@ public void testSavingsImport() throws InterruptedException, IOException, ParseE
Assert.assertNotNull(importDocumentId);

//Wait for the creation of output excel
Thread.sleep(3000);
Thread.sleep(10000);

//check status column of output excel
String location=savingsAccountHelper.getOutputTemplateLocation(importDocumentId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1187,8 +1187,8 @@ public GenericResultsetData retrieveDataTableGenericResultSet(final String dataT
sql = sql + "select * from `" + dataTableName + "` where id = " + id;
}

this.columnValidator.validateSqlInjection(sql, order);
if (order != null) {
if (StringUtils.isNotBlank(order)) {
this.columnValidator.validateSqlInjection(sql, order);
sql = sql + " order by " + order;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,34 @@ public class AccountSummaryCollectionData {
private final Collection<LoanAccountSummaryData> loanAccounts;
private final Collection<SavingsAccountSummaryData> savingsAccounts;
private final Collection<ShareAccountSummaryData> shareAccounts ;
private final Collection<GuarantorAccountSummaryData> guarantorAccounts;

private final Collection<LoanAccountSummaryData> memberLoanAccounts;
private final Collection<SavingsAccountSummaryData> memberSavingsAccounts;

private final Collection<GuarantorAccountSummaryData> memberGuarantorAccounts;

public AccountSummaryCollectionData(final Collection<LoanAccountSummaryData> loanAccounts,
final Collection<SavingsAccountSummaryData> savingsAccounts, final Collection<ShareAccountSummaryData> shareAccounts) {
final Collection<SavingsAccountSummaryData> savingsAccounts, final Collection<ShareAccountSummaryData> shareAccounts,
final Collection<GuarantorAccountSummaryData> guarantorAccounts) {
this.loanAccounts = defaultLoanAccountsIfEmpty(loanAccounts);
this.savingsAccounts = defaultSavingsAccountsIfEmpty(savingsAccounts);
this.shareAccounts = defaultShareAccountsIfEmpty(shareAccounts) ;
this.guarantorAccounts = guarantorAccounts;
this.memberLoanAccounts = null;
this.memberSavingsAccounts = null;
this.memberGuarantorAccounts = null;
}

public AccountSummaryCollectionData(final Collection<LoanAccountSummaryData> loanAccounts,
final Collection<SavingsAccountSummaryData> savingsAccounts, final Collection<LoanAccountSummaryData> memberLoanAccounts,
final Collection<SavingsAccountSummaryData> memberSavingsAccounts) {
final Collection<SavingsAccountSummaryData> savingsAccounts, final Collection<GuarantorAccountSummaryData> guarantorAccounts, final Collection<LoanAccountSummaryData> memberLoanAccounts,
final Collection<SavingsAccountSummaryData> memberSavingsAccounts, final Collection<GuarantorAccountSummaryData> memberGuarantorAccounts) {
this.loanAccounts = defaultLoanAccountsIfEmpty(loanAccounts);
this.savingsAccounts = defaultSavingsAccountsIfEmpty(savingsAccounts);
this.guarantorAccounts = guarantorAccounts;
this.shareAccounts = null ;
this.memberLoanAccounts = defaultLoanAccountsIfEmpty(memberLoanAccounts);
this.memberSavingsAccounts = defaultSavingsAccountsIfEmpty(memberSavingsAccounts);
this.memberGuarantorAccounts = defaultGuarantorAccountsIfEmpty(memberGuarantorAccounts);
}

private Collection<LoanAccountSummaryData> defaultLoanAccountsIfEmpty(final Collection<LoanAccountSummaryData> collection) {
Expand All @@ -76,4 +83,11 @@ private Collection<ShareAccountSummaryData> defaultShareAccountsIfEmpty(final Co
return returnCollection;
}

private Collection<GuarantorAccountSummaryData> defaultGuarantorAccountsIfEmpty(final Collection<GuarantorAccountSummaryData> collection) {
Collection<GuarantorAccountSummaryData> returnCollection = null;
if (collection != null && !collection.isEmpty()) {
returnCollection = collection;
}
return returnCollection;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/**
* 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.portfolio.accountdetails.data;

import java.math.BigDecimal;

import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.portfolio.loanaccount.data.LoanApplicationTimelineData;
import org.apache.fineract.portfolio.loanaccount.data.LoanStatusEnumData;

/**
* Immutable data object for loan accounts.
*/
@SuppressWarnings("unused")
public class GuarantorAccountSummaryData {

private final Long id;
private final String accountNo;
private final String externalId;
private final Long productId;
private final String productName;
private final String shortProductName;
private final LoanStatusEnumData status;
private final EnumOptionData loanType;
private final Integer loanCycle;
private final Boolean inArrears;
private final BigDecimal originalLoan;
private final BigDecimal loanBalance;
private final BigDecimal amountPaid;
private final Boolean isActive;
private final String relationship;
private final BigDecimal onHoldAmount;
public GuarantorAccountSummaryData(final Long id, final String accountNo, final String externalId, final Long productId,
final String loanProductName, final String shortLoanProductName, final LoanStatusEnumData loanStatus, final EnumOptionData loanType, final Integer loanCycle,
final Boolean inArrears,final BigDecimal originalLoan,final BigDecimal loanBalance,final BigDecimal amountPaid,
final Boolean isActive, final String relationship, final BigDecimal onHoldAmount) {
this.id = id;
this.accountNo = accountNo;
this.externalId = externalId;
this.productId = productId;
this.productName = loanProductName;
this.shortProductName = shortLoanProductName;
this.status = loanStatus;
this.loanType = loanType;
this.loanCycle = loanCycle;
this.inArrears = inArrears;
this.loanBalance = loanBalance;
this.originalLoan = originalLoan;
this.amountPaid = amountPaid;
this.isActive = isActive;
this.relationship = relationship;
this.onHoldAmount = onHoldAmount;
}
}
Loading

0 comments on commit add8795

Please sign in to comment.